/* TorchIO landing page. Palette derived from the logo:
   purple #812CE5, ink #262626, gray #BBBBBB */

/* Self-hosted variable fonts (SIL OFL). Licenses in assets/fonts/. */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/bricolage-grotesque-latin-wght-normal.woff2")
    format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Hanken Grotesk";
  src: url("../fonts/hanken-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand: #812ce5; /* exact TorchIO logo purple */
  /* All purples below derive from the logo purple above. */
  --brand-strong: #6c25c0; /* fallback for browsers without color-mix() */
  --brand-strong: color-mix(in srgb, var(--brand) 84%, #000);
  --brand-soft: #ae78ee;
  --brand-soft: color-mix(in srgb, var(--brand) 64%, #fff);
  --brand-tint: rgba(129, 44, 229, 0.1);
  --brand-tint: color-mix(in srgb, var(--brand) 10%, transparent);
  --ink: #262626;
  --gray: #bbbbbb;

  --bg: #ffffff;
  --bg-soft: #f7f5fb;
  --surface: #ffffff;
  --surface-2: #faf9fd;
  --text: #1c1b22;
  --text-muted: #5c5870;
  --border: rgba(38, 38, 38, 0.1);
  --shadow: 0 1px 2px rgba(38, 38, 38, 0.04), 0 12px 32px rgba(38, 38, 38, 0.06);

  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1120px;

  --font-display: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  --font-sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "SFMono-Regular",
    Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Lighten the logo purple for legibility on dark surfaces (same hue). */
    --brand: #a161ec; /* fallback for browsers without color-mix() */
    --brand: color-mix(in srgb, #812ce5 75%, #fff);
    --brand-strong: #812ce5;
    --brand-soft: #ba8bf1;
    --brand-soft: color-mix(in srgb, #812ce5 55%, #fff);
    --brand-tint: rgba(129, 44, 229, 0.22);
    --brand-tint: color-mix(in srgb, #812ce5 22%, transparent);

    --bg: #141118;
    --bg-soft: #1a1722;
    --surface: #1d1a25;
    --surface-2: #221e2c;
    --text: #ecebf2;
    --text-muted: #a8a2bb;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px rgba(0, 0, 0, 0.45);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--brand-strong);
}

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
}

p {
  margin: 0;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 24px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  transform: translateY(calc(-100% - 24px));
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 10px 14px;
  font-weight: 600;
  transition: transform 0.15s ease;
}

.skip-link:focus-visible {
  transform: translateY(0);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.section {
  padding-block: clamp(56px, 9vw, 112px);
}

.eyebrow {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--brand);
  margin-bottom: 12px;
}

.section-head {
  max-width: 720px;
  margin-bottom: 48px;
}

.section-head h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  font-weight: 700;
}

.section-head p {
  margin-top: 14px;
  font-size: 1.08rem;
  color: var(--text-muted);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand img {
  width: 28px;
  height: 28px;
}

.nav-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 26px;
}

.nav-links a:not(.btn) {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
}

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

.nav-cta {
  display: inline-flex;
}

@media (max-width: 760px) {
  .nav-links .hide-sm {
    display: none;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.96rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease,
    border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-strong);
  color: #fff;
}

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.btn svg {
  width: 18px;
  height: 18px;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding-block: clamp(64px, 10vw, 128px);
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}

@media (max-width: 920px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.035em;
}

.hero h1 .accent {
  color: var(--brand);
}

.hero-lede {
  margin-top: 22px;
  font-size: 1.18rem;
  color: var(--text-muted);
  max-width: 560px;
}

.hero-actions {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.install {
  margin-top: 26px;
  display: inline-flex;
  align-items: stretch;
  max-width: 360px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.install code {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  color: var(--text);
}

.install code .prompt {
  color: var(--brand);
  user-select: none;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  border: none;
  border-left: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.copy-btn:hover {
  color: var(--brand);
  background: var(--brand-tint);
}

.copy-btn svg {
  width: 17px;
  height: 17px;
}

.copy-btn.copied {
  color: #18a957;
}

/* ---------- Hero code card ---------- */
.code-card {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.code-card .code-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.code-file {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.code-card pre {
  margin: 0;
  padding: 20px 22px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.7;
  tab-size: 2;
}

.code-card code {
  font-family: inherit;
}

.tok-c {
  color: var(--text-muted);
}
.tok-k {
  color: var(--brand);
  font-weight: 600;
}
.tok-s {
  color: #18a957;
}
.tok-f {
  color: var(--brand-soft);
}
@media (prefers-color-scheme: dark) {
  .tok-s {
    color: #5cd38a;
  }
}

/* ---------- Trusted-by strip ---------- */
.strip {
  border-block: 1px solid var(--border);
  background: var(--bg-soft);
}

.strip .container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 40px;
  padding-block: 26px;
}

.strip .label {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.strip .names {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  font-weight: 600;
  color: var(--text);
  opacity: 0.8;
}

.strip .names a {
  color: inherit;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.strip .names a:hover {
  color: var(--brand);
  opacity: 1;
}

/* ---------- Augmentations showcase ---------- */
.aug {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 38px;
  align-items: center;
}

.aug-slider {
  position: relative;
  aspect-ratio: 2 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  touch-action: none;
  user-select: none;
  cursor: ew-resize;
}

.aug-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* The original sits on top, clipped from the left edge to the handle. */
.aug-before {
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}

.aug-tag {
  position: absolute;
  top: 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.18);
  pointer-events: none;
  z-index: 2;
}

.aug-tag--before {
  left: 12px;
}

.aug-tag--after {
  right: 12px;
}

.aug-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 1px;
  margin-left: -0.5px;
  background: rgba(255, 255, 255, 0.5);
  z-index: 3;
  pointer-events: none;
}

.aug-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.5);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.aug-slider:hover .aug-handle {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.75);
}

.aug-handle svg {
  width: 11px;
  height: 11px;
}

/* Visually hidden range input; drives keyboard accessibility. */
.aug-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.aug-slider:focus-within .aug-handle {
  background: rgba(255, 255, 255, 0.22);
  border-color: #fff;
  box-shadow: 0 0 0 3px var(--brand-tint);
}

.aug-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 22px;
}

.aug-tab {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease,
    box-shadow 0.15s ease;
}

.aug-tab:hover {
  color: var(--brand);
  border-color: var(--brand);
}

.aug-tab.is-active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.aug-code {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--brand);
  background: var(--brand-tint);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

.aug-desc {
  color: var(--text-muted);
  font-size: 1.02rem;
  min-height: 3.1em;
}

.aug-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 18px;
  font-weight: 600;
  font-size: 0.95rem;
}

.aug-link svg {
  width: 16px;
  height: 16px;
  transition: transform 0.15s ease;
}

.aug-link:hover svg {
  transform: translateX(3px);
}

@media (max-width: 900px) {
  .aug {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* ---------- Features ---------- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

@media (max-width: 900px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.card {
  padding: 28px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.card-link {
  display: block;
  color: var(--text);
}

.card-link:hover {
  color: var(--text);
}

.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
  box-shadow: var(--shadow);
}

.card .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--brand-tint);
  color: var(--brand);
  margin-bottom: 18px;
}

.card .icon svg {
  width: 24px;
  height: 24px;
}

.card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.card p {
  color: var(--text-muted);
  font-size: 0.98rem;
}

.card-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  color: var(--brand);
  font-weight: 600;
  font-size: 0.92rem;
}

.card-more::after {
  content: "->";
  transition: transform 0.15s ease;
}

.card-link:hover .card-more::after {
  transform: translateX(3px);
}

/* ---------- CTA band ---------- */
.cta {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--radius) + 6px);
  padding: clamp(40px, 6vw, 72px);
  text-align: center;
  color: #fff;
  background: var(--brand);
}

/* Pin the CTA band to the exact logo purple in both themes. */
@media (prefers-color-scheme: dark) {
  .cta {
    background: var(--brand-strong);
  }
}

.cta h2 {
  font-size: clamp(1.7rem, 3.6vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.cta p {
  margin: 14px auto 30px;
  max-width: 560px;
  font-size: 1.1rem;
}

.cta .btn-primary {
  background: #fff;
  color: var(--brand-strong);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.cta .btn-primary:hover {
  background: #f3eefb;
  color: var(--brand-strong);
}

.cta .btn-ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

.cta .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  border-color: #fff;
}

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}

/* Eyebrow on the dark gradient band */
.cta .eyebrow {
  color: rgba(255, 255, 255, 0.95);
}

/* Pipeline showcase */
.pipeline {
  display: flex;
  align-items: stretch;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  max-width: 900px;
  margin: 40px auto 36px;
  text-align: left;
}

.pipe-step {
  position: relative;
  flex: 1 1 210px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 20px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  transition: transform 0.18s ease, background 0.18s ease;
}

.pipe-step:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.18);
}

.pipe-step--wide {
  flex-grow: 1.35;
}

.pipe-num {
  position: absolute;
  top: 16px;
  right: 18px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
}

.pipe-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.pipe-icon svg {
  width: 22px;
  height: 22px;
}

.pipe-title {
  font-weight: 700;
  font-size: 1.04rem;
  color: #fff;
}

.pipe-sub {
  font-size: 0.9rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.92);
}

.pipe-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.pipe-chips span {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: #fff;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.pipe-arrow {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.85);
}

.pipe-arrow svg {
  width: 26px;
  height: 26px;
}

@media (max-width: 760px) {
  .pipeline {
    flex-direction: column;
    align-items: stretch;
    max-width: 380px;
  }

  .pipe-arrow {
    justify-content: center;
    transform: rotate(90deg);
  }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding-block: 48px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 32px;
}

@media (max-width: 760px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.footer-brand .brand {
  margin-bottom: 12px;
}

.footer-brand p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 280px;
}

.footer-col h3 {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 14px;
}

.footer-col a {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 10px;
}

.footer-col a:hover {
  color: var(--brand);
}

.footer-bottom {
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---------- Reveal-on-scroll ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.js .reveal.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
