/* trendsandscalps — trading technology studio.
   Ink black, warm bone white, one signal orange. Type does most of the work. */

:root {
  --ink: #08080a;
  --ink-2: #0e0e11;
  --ink-3: #16161a;
  --bone: #ece7de;
  --bone-dim: #a9a49b;
  --bone-faint: #5f5b55;
  --hair: rgba(236, 231, 222, 0.12);
  --signal: #ff5a1f;
  --signal-soft: rgba(255, 90, 31, 0.14);
  --sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --gutter: clamp(16px, 4vw, 56px);
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
}

* { box-sizing: border-box; }
html { background: var(--ink); }
body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.035em; line-height: 0.95; }
p { margin: 0; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em; }
::selection { background: var(--signal); color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bone-dim);
  display: flex; align-items: center; gap: 10px;
}
.label::before { content: ""; width: 18px; height: 1px; background: var(--signal); }

.display { font-size: clamp(3rem, 8vw, 7.5rem); }
.display-sm { font-size: clamp(1.9rem, 3.6vw, 3.2rem); line-height: 1.02; }
.display em, .display-sm em { color: var(--signal); }

/* ---------- canvas + grain ---------- */
#scene {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.6s var(--ease);
}
body.scene-ready #scene { opacity: 1; }
.grain {
  position: fixed; inset: -50%;
  z-index: 1; pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
main, .footer, .nav { position: relative; z-index: 2; }

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px var(--gutter);
  transition: background .4s var(--ease), backdrop-filter .4s var(--ease);
}
.nav.is-scrolled { background: rgba(8, 8, 10, 0.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--hair); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: -0.02em; font-size: 1.02rem; }
.brand-mark { width: 24px; height: 24px; }
.nav-links { display: flex; align-items: center; gap: 30px; }
.nav-links a { text-decoration: none; font-size: 0.92rem; position: relative; }
.nav-links a:not(.nav-cta)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: right;
  transition: transform .5s var(--ease);
}
.nav-links a:not(.nav-cta):hover::after { transform: scaleX(1); transform-origin: left; }
.nav-cta { border: 1px solid currentColor; border-radius: 999px; padding: 7px 16px; }

/* ---------- hero ---------- */
.hero {
  min-height: 100svh;
  padding: 120px var(--gutter) 40px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 28px;
  position: relative;
}
.hero-meta { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--bone-dim); display: flex; align-items: center; gap: 14px; }
.hero-meta .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 12px var(--signal); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.hero-title {
  align-self: end;
  font-size: clamp(3.4rem, 11.5vw, 12.5rem);
  font-weight: 500;
  line-height: 0.88;
  letter-spacing: -0.055em;
}
.hero-title .line { display: block; overflow: hidden; padding-bottom: 0.06em; }
.hero-title .line > span { display: inline-block; transform: translateY(105%); transition: transform 1.3s var(--ease); }
.hero-title .line:nth-child(2) > span { transition-delay: .08s; }
.hero-title .line:nth-child(3) > span { transition-delay: .16s; }
.hero-title em { color: var(--signal); padding-right: 0.06em; }
body:not(.is-loading) .hero-title .line > span { transform: none; }

.hero-foot { display: flex; justify-content: space-between; align-items: end; gap: 32px; flex-wrap: wrap; }
.hero-lede { max-width: 520px; color: var(--bone-dim); font-size: 1.08rem; }

.capabilities {
  list-style: none; margin: 0; padding: 18px 0 0;
  border-top: 1px solid var(--hair);
  display: flex; flex-wrap: wrap; gap: 8px 36px;
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--bone-dim);
}
.capabilities li::before { content: "+ "; color: var(--signal); }

.scroll-cue {
  position: absolute; right: var(--gutter); bottom: 44px;
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--bone-dim);
  writing-mode: vertical-rl; display: flex; align-items: center; gap: 12px;
}
.scroll-cue span { width: 1px; height: 56px; background: linear-gradient(var(--bone), transparent); animation: cue 2.2s var(--ease) infinite; transform-origin: top; }
@keyframes cue { 0% { transform: scaleY(0); } 60% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* ---------- pill buttons ---------- */
.pill, .ts-cta, .submit {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 8px 8px 8px 24px;
  border-radius: 999px;
  text-decoration: none;
  font: 500 1rem var(--sans);
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background .4s var(--ease), color .4s var(--ease), border-color .4s var(--ease);
}
.pill svg, .ts-cta svg, .submit svg {
  width: 40px; height: 40px; padding: 11px; border-radius: 50%;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .5s var(--ease), background .4s var(--ease);
}
.pill { background: var(--bone); color: var(--ink); }
.pill svg { background: var(--ink); color: var(--bone); }
.pill:hover { background: var(--signal); }
.pill:hover svg, .ts-cta:hover svg { transform: rotate(45deg); }

/* ---------- manifesto ---------- */
.manifesto { min-height: 90vh; display: grid; align-items: center; padding: 18vh var(--gutter); }
.manifesto-text {
  font-size: clamp(2rem, 5.2vw, 5.2rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
  font-weight: 400;
  max-width: 17ch;
  max-width: 1400px;
}
.manifesto-text .w { color: var(--bone-faint); transition: color .5s linear; }
.manifesto-text .w.on { color: var(--bone); }
.manifesto-text .w.accent.on { color: var(--signal); font-family: var(--serif); font-style: italic; }

/* ---------- chapters (pinned) ---------- */
.chapters { height: 420vh; position: relative; }
.chapters-pin {
  position: sticky; top: 0; height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  padding: 110px var(--gutter) 44px;
  gap: 24px;
  overflow: hidden;
}
.chapters-rail { position: absolute; left: var(--gutter); right: var(--gutter); top: 90px; height: 1px; background: var(--hair); }
.rail-fill { position: absolute; inset: 0; background: var(--signal); transform-origin: left; transform: scaleX(0); }
.chapters-index {
  grid-column: 2; grid-row: 1; align-self: start; justify-self: end;
  font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.1em; color: var(--bone-dim);
}
.idx-current { color: var(--bone); font-size: 2.6rem; font-family: var(--sans); font-weight: 300; letter-spacing: -0.04em; margin-right: 4px; }

.chapter-stack { grid-column: 1; grid-row: 1; position: relative; align-self: center; min-height: 440px; }
.chapter {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center; gap: 26px;
  opacity: 0; transform: translateY(40px);
  transition: opacity .8s var(--ease), transform 1s var(--ease);
  pointer-events: none;
}
.chapter.is-active { opacity: 1; transform: none; pointer-events: auto; }
.chapter.is-past { transform: translateY(-40px); }
.chapter-kicker { font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--signal); }
.chapter-title { font-size: clamp(2.8rem, 6.4vw, 6.4rem); line-height: 0.92; }
.chapter-title em { color: var(--bone-dim); }
.chapter-body { max-width: 470px; color: var(--bone-dim); font-size: 1.05rem; }
.chapter-body a { color: var(--bone); text-decoration-color: var(--signal); text-underline-offset: 3px; }

.chapter-tabs {
  grid-column: 1 / -1; grid-row: 2;
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--hair);
}
.chapter-tabs li {
  padding-top: 14px;
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--bone-faint);
  transition: color .5s var(--ease);
}
.chapter-tabs li.is-active { color: var(--bone); }
.chapter-tabs li.is-active::before { content: "● "; color: var(--signal); }

/* ---------- instruments marquee ---------- */
.instruments { padding: 16vh 0 14vh; border-top: 1px solid var(--hair); background: linear-gradient(transparent, rgba(8,8,10,0.85) 30%); }
.instruments-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding: 0 var(--gutter) 48px; }
.instruments-note { color: var(--bone-dim); max-width: 380px; }
.marquee { overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee-track {
  display: flex; align-items: center; gap: 48px; width: max-content;
  animation: marquee 48s linear infinite;
  font-size: clamp(3rem, 8vw, 7.5rem); letter-spacing: -0.045em; font-weight: 500; white-space: nowrap;
}
.marquee-track span { color: #3a3833; transition: color .5s var(--ease); }
.marquee-track span:hover { color: var(--bone); }
.marquee-track span em { color: var(--signal); font-size: 0.42em; letter-spacing: -0.01em; vertical-align: 0.9em; }
.marquee-track i { width: 14px; height: 14px; border-radius: 50%; background: var(--signal); flex: none; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- process ---------- */
.process { padding: 16vh var(--gutter); background: var(--ink); border-top: 1px solid var(--hair); }
.section-head { display: grid; gap: 28px; margin-bottom: 11vh; }
.steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--hair);
}
.step { padding: 26px 22px 34px 0; border-right: 1px solid var(--hair); position: relative; }
.step:last-child { border-right: 0; }
.step::before {
  content: ""; position: absolute; top: -1px; left: 0; height: 1px; width: 0;
  background: var(--signal); transition: width 1.2s var(--ease);
}
.step.in::before { width: 100%; }
.step + .step { padding-left: 22px; }
.step-n { font-family: var(--mono); font-size: 0.74rem; color: var(--signal); letter-spacing: 0.1em; }
.step h3 { font-size: 1.35rem; letter-spacing: -0.025em; margin: 48px 0 14px; line-height: 1.05; }
.step p { color: var(--bone-dim); font-size: 0.95rem; }

.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin-top: 14vh; border-top: 1px solid var(--hair); }
.principle { padding: 34px 28px 0 0; }
.principle + .principle { padding-left: 28px; border-left: 1px solid var(--hair); }
.principle-n { font-family: var(--serif); font-style: italic; font-size: 1.6rem; color: var(--signal); }
.principle h3 { font-size: clamp(1.6rem, 2.6vw, 2.3rem); margin: 18px 0 14px; line-height: 1; }
.principle p { color: var(--bone-dim); }

/* ---------- tradeself ---------- */
.product { padding: 4vh var(--gutter) 10vh; background: var(--ink); }
.product-frame {
  position: relative;
  display: grid; grid-template-columns: 1fr 1.6fr; gap: 48px;
  padding: clamp(28px, 5vw, 72px);
  background: var(--ink-2);
  border: 1px solid var(--hair);
  border-radius: 28px;
  overflow: hidden;
}
.product-frame::after {
  content: ""; position: absolute; width: 520px; height: 520px; right: -160px; bottom: -220px;
  background: radial-gradient(closest-side, rgba(56, 189, 248, 0.14), transparent);
  pointer-events: none;
}
.product-meta { display: flex; flex-direction: column; gap: 28px; }
.product-logo { width: 220px; height: auto; border-radius: 10px; }
.product-copy { display: flex; flex-direction: column; gap: 26px; position: relative; z-index: 1; }
.product-copy .display-sm em { color: var(--bone-dim); }
.product-copy > p { color: var(--bone-dim); max-width: 560px; }
.product-icon {
  position: absolute; right: clamp(20px, 4vw, 60px); top: clamp(20px, 4vw, 60px);
  width: 64px; height: 64px; opacity: 0.9;
}
.ts-cta { align-self: flex-start; border: 1px solid var(--hair); color: var(--bone); }
.ts-cta svg { background: var(--bone); color: var(--ink); }
.ts-cta:hover { border-color: #38bdf8; }

/* ---------- contact ---------- */
.contact {
  padding: 16vh var(--gutter);
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(40px, 6vw, 100px);
  background: var(--ink);
  border-top: 1px solid var(--hair);
}
.contact-copy { display: flex; flex-direction: column; gap: 32px; }
.paths { display: grid; gap: 28px; margin-top: 12px; }
.path { border-left: 1px solid var(--signal); padding-left: 22px; }
.path h3 { font-size: 1.5rem; letter-spacing: -0.03em; margin-bottom: 10px; line-height: 1.05; }
.path p { color: var(--bone-dim); }
.contact-note { color: var(--bone-dim); font-size: 0.95rem; }
.contact-note a { color: var(--bone); text-decoration-color: var(--signal); text-underline-offset: 3px; }

.form { align-self: end; display: flex; flex-direction: column; gap: 26px; }
.field { border: 0; margin: 0; padding: 0; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
label, legend { display: block; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--bone-dim); margin-bottom: 10px; padding: 0; }
.opt { color: var(--bone-faint); }
input[type="text"], input[type="email"], input[type="tel"], select {
  width: 100%;
  background: transparent;
  color: var(--bone);
  border: 0; border-bottom: 1px solid var(--hair);
  border-radius: 0;
  padding: 10px 0 12px;
  font: 400 1.25rem var(--sans); letter-spacing: -0.02em;
  transition: border-color .4s var(--ease);
  -webkit-appearance: none; appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 8l5 5 5-5' fill='none' stroke='%23a9a49b' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right center; background-size: 18px;
  cursor: pointer;
}
select option { background: var(--ink-3); color: var(--bone); }
input:focus, select:focus { outline: none; border-bottom-color: var(--signal); }
.field.invalid input { border-bottom-color: #ff4d4d; }

.toggles { display: flex; flex-wrap: wrap; gap: 10px; }
.toggles label { margin: 0; text-transform: none; letter-spacing: -0.01em; font: 400 0.98rem var(--sans); color: var(--bone); cursor: pointer; }
.toggles input { position: absolute; opacity: 0; pointer-events: none; }
.toggles span {
  display: inline-block; padding: 9px 18px; border-radius: 999px;
  border: 1px solid var(--hair);
  transition: background .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease);
}
.toggles label:hover span { border-color: var(--bone-dim); }
.toggles input:checked + span { background: var(--bone); color: var(--ink); border-color: var(--bone); }
.toggles input:focus-visible + span { outline: 2px solid var(--signal); outline-offset: 2px; }

.submit { align-self: flex-start; border: 0; background: var(--signal); color: var(--ink); margin-top: 8px; }
.submit svg { background: var(--ink); color: var(--bone); }
.submit:hover svg { transform: translateX(4px); }
.hp { position: absolute; left: -9999px; }
.form-status { font-size: 0.95rem; min-height: 1.4em; color: var(--bone-dim); }
.form-status.ok { color: var(--bone); }
.form-status.err { color: #ff6b6b; }

/* ---------- footer ---------- */
.footer { background: var(--ink); padding: 10vh var(--gutter) 36px; border-top: 1px solid var(--hair); overflow: hidden; }
.footer-mark {
  font-size: clamp(3rem, 13.4vw, 15rem);
  font-weight: 600; letter-spacing: -0.065em; line-height: 0.8;
  color: #1b1a1d;
  white-space: nowrap;
  margin: 0 0 6vh -0.04em;
}
.footer-row { display: grid; gap: 28px; }
.disclaimer { color: var(--bone-faint); font-size: 0.82rem; }
.disclaimer p + p { margin-top: 10px; }
.disclaimer strong { color: var(--bone-dim); font-weight: 500; }
.footer-links { font-size: 0.9rem; color: var(--bone-dim); }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(36px); transition: opacity 1s var(--ease), transform 1.2s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .steps { grid-template-columns: 1fr 1fr; }
  .step, .step + .step { padding: 24px 18px 30px 0; border-right: 0; border-bottom: 1px solid var(--hair); }
  .principles { grid-template-columns: 1fr; }
  .principle + .principle { padding-left: 0; border-left: 0; border-top: 1px solid var(--hair); margin-top: 28px; }
  .product-frame, .contact { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .nav-links a:not(.nav-cta) { display: none; }
  .hero { padding-top: 100px; }
  .scroll-cue { display: none; }
  .hero-meta { font-size: 0.66rem; letter-spacing: 0.1em; gap: 10px; }
  .chapters-pin { grid-template-columns: 1fr; padding-top: 96px; }
  .chapters-index { grid-column: 1; justify-self: start; }
  .chapter-stack { grid-row: 1; min-height: 60vh; align-self: end; }
  .chapters-index { display: none; }
  .chapter-tabs li { font-size: 0.58rem; letter-spacing: 0.08em; }
  .steps { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .product-icon { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
  .hero-title .line > span { transform: none; }
}
