/* =====================================================================
   Alpaca Trading Terminal — download site
   Custom styles that complement Tailwind (Play CDN). Tailwind handles
   layout/spacing utilities in the HTML; this file defines the component
   classes and animations. Palette matches the app's src/theme.rs.
   ===================================================================== */

:root {
  --ink: #000000;
  --coal: #0a0a0a;
  --panel: #0d0d0d;
  --panel2: #141414;
  --line: #242424;
  --orange: #ff6600;
  --cyan: #00bfff;
  --up: #00ff41;
  --down: #ff3131;
  --gold: #ffd700;
  --mute: #888888;
  --mute2: #555555;
}

html { scroll-padding-top: 96px; } /* offset sticky header on anchor jumps */
body { -webkit-font-smoothing: antialiased; }

/* Accessible skip link */
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  border-radius: 8px;
  background: var(--orange);
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

/* Crisp focus ring everywhere */
:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Custom scrollbar (WebKit) */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 6px; border: 2px solid var(--ink); }
::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }

/* ───────────────────────── Hero backdrop ─────────────────────────
   Subtle terminal grid + an orange glow bleeding from the top-left. */
.hero-bg {
  background:
    radial-gradient(60rem 40rem at 12% -10%, rgba(255, 102, 0, .14), transparent 60%),
    radial-gradient(50rem 40rem at 110% 10%, rgba(0, 191, 255, .08), transparent 55%),
    linear-gradient(to bottom, var(--ink), var(--coal));
  position: relative;
}
.hero-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(70% 60% at 50% 30%, #000 40%, transparent 100%);
          mask-image: radial-gradient(70% 60% at 50% 30%, #000 40%, transparent 100%);
  pointer-events: none;
}

.app-window {
  background: linear-gradient(to bottom, var(--panel2), var(--panel));
}

/* ───────────────────────── Ticker tape ───────────────────────── */
.ticker-wrap { overflow: hidden; white-space: nowrap; }
.ticker-track {
  display: inline-flex;
  gap: 2.5rem;
  padding: 6px 1.25rem;
  animation: ticker 38s linear infinite;
  will-change: transform;
}
.ticker-track .tk i { font-style: normal; margin-left: .35rem; }
@keyframes ticker {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); } /* track holds two identical halves */
}

/* ───────────────────────── Scroll reveal ─────────────────────────
   Content is visible by default. Only when JS is present (html.js) do we
   hide-then-reveal, so no-JS users never lose content. */
html.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .6s ease, transform .6s ease;
  transition-delay: var(--reveal-delay, 0ms);
}
html.js .reveal.in {
  opacity: 1;
  transform: none;
}

/* ───────────────────────── Feature cards ───────────────────────── */
.feature-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(to bottom, var(--panel), #0b0b0b);
  padding: 1.5rem;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.feature-card:hover {
  border-color: #383838;
  transform: translateY(-3px);
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, .9);
}
.feature-ico {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
  margin-bottom: 1rem;
}
.feature-ico svg { width: 22px; height: 22px; }
.feature-title { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.01em; }
.feature-body { margin-top: .5rem; font-size: .9rem; line-height: 1.6; color: var(--mute); }

/* keyboard key */
.kbd {
  display: inline-block;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: .75rem;
  padding: .05rem .4rem;
  border-radius: 5px;
  background: #1a1a1a;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  color: #ddd;
}

/* ───────────────────────── Download cards ───────────────────────── */
.download-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(to bottom, var(--panel), #0b0b0b);
  padding: 2rem 1.5rem 1.75rem;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.download-card:hover { border-color: #383838; transform: translateY(-3px); }

/* highlighted by JS for the detected OS */
.download-card.is-recommended {
  border-color: var(--orange);
  box-shadow: 0 0 0 1px var(--orange), 0 24px 60px -28px rgba(255, 102, 0, .55);
}

.recommended-badge {
  position: absolute;
  top: -.8rem;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  border-radius: 999px;
  background: var(--orange);
  color: var(--ink);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .01em;
  padding: .3rem .85rem;
  box-shadow: 0 8px 20px -8px rgba(255, 102, 0, .8);
}

.os-ico {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 1rem;
  color: #fff;
}
.os-ico svg { width: 40px; height: 40px; }
.os-title { font-size: 1.25rem; font-weight: 700; }
.os-sub { margin-top: .35rem; font-size: .8rem; color: var(--mute); min-height: 2.5rem; }

.dl-btn {
  margin-top: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  justify-content: center;
  border-radius: 10px;
  background: var(--orange);
  color: var(--ink);
  font-weight: 700;
  font-size: .95rem;
  padding: .8rem 1rem;
  transition: filter .15s ease;
}
.dl-btn:hover { filter: brightness(1.1); }
.dl-btn--ghost {
  background: transparent;
  color: #fff;
  border: 1px solid var(--line);
}
.dl-btn--ghost:hover { background: var(--panel2); filter: none; border-color: var(--mute2); }
.dl-size {
  font-family: "JetBrains Mono", monospace;
  font-size: .7rem;
  font-weight: 500;
  padding: .1rem .45rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, .25);
}
.dl-btn--ghost .dl-size { background: rgba(255, 255, 255, .06); color: var(--mute); }
.dl-link {
  margin-top: .85rem;
  font-size: .8rem;
  color: var(--cyan);
}
a.dl-link:hover { text-decoration: underline; }

/* ───────────────────────── Install cards ───────────────────────── */
.install-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 1.5rem;
}
.install-head { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.install-steps {
  list-style: decimal;
  padding-left: 1.1rem;
  font-size: .875rem;
  line-height: 1.6;
  color: var(--mute);
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.install-steps code { color: #ddd; font-family: "JetBrains Mono", monospace; font-size: .8rem; }
.install-foot { margin-top: 1rem; font-size: .78rem; color: var(--mute2); }
.install-foot code { color: var(--mute); }

/* code block with copy button */
.code { position: relative; margin-top: 1rem; }
.code pre {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #060606;
  padding: 1rem;
  padding-right: 4rem;
}
.code code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: .78rem;
  line-height: 1.55;
  color: var(--up);
  white-space: pre;
}
.copy-btn {
  position: absolute;
  top: .55rem;
  right: .55rem;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #161616;
  color: var(--mute);
  font-size: .68rem;
  font-weight: 600;
  padding: .25rem .55rem;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.copy-btn:hover { color: #fff; border-color: var(--mute2); }
.copy-btn.copied { color: var(--up); border-color: var(--up); }

/* misc inline bits */
.path {
  font-family: "JetBrains Mono", monospace;
  font-size: .8em;
  color: var(--cyan);
  word-break: break-all;
}
.lnk { color: var(--cyan); }
.lnk:hover { text-decoration: underline; }

.chip {
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #111;
  padding: .3rem .6rem;
  color: #ccc;
}

/* ───────────────────────── Reduced motion ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
  html.js .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  .feature-card:hover, .download-card:hover { transform: none; }
}
