/* ── torchfits docs ─────────────────────────────────────────── */

@import url("https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;600;700&family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  --tf-navy: #0b1f3a;
  --tf-navy-mid: #14345c;
  --tf-blue: #2b7de9;
  --tf-orange: #f18a1f;
  --tf-ink: #132238;
  --tf-muted: #5a6b7d;
  --tf-paper: #f4f7fb;
  --tf-line: rgba(11, 31, 58, 0.12);
  --md-text-font: "Source Sans 3", "Segoe UI", sans-serif;
  --md-code-font: "IBM Plex Mono", ui-monospace, monospace;
}

[data-md-color-scheme="slate"] {
  --tf-paper: #0d1520;
  --tf-ink: #e8eef6;
  --tf-muted: #9aabbd;
  --tf-line: rgba(232, 238, 246, 0.14);
}

body,
.md-typeset {
  font-family: var(--md-text-font);
}

.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-header__topic,
.tf-hero__headline {
  font-family: "Space Grotesk", var(--md-text-font);
  letter-spacing: -0.02em;
}

.md-header__button.md-logo img {
  height: 1.85rem;
  width: auto;
}

/* Edge docs channel banner (overrides/main.html announce block) */
.tf-edge-banner {
  display: block;
  width: 100%;
  padding: 0.55rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: #132238;
  background: linear-gradient(90deg, #ffe8c2, #ffd18a);
  border-bottom: 1px solid rgba(11, 31, 58, 0.12);
}
.tf-edge-banner a {
  color: #14345c;
  font-weight: 600;
}
[data-md-color-scheme="slate"] .tf-edge-banner {
  color: #0d1520;
}

/* ── Landing hero ───────────────────────────────────────────── */

.md-content[data-md-component="content"] .tf-hero + *,
.tf-home .md-sidebar {
  /* sidebars handled below on homepage */
}

.tf-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: var(--tf-ink);
  background: #e9f0f8;
  margin: 0;
  padding: clamp(1.75rem, 4vw, 2.75rem) 1.25rem clamp(2rem, 4vw, 3rem);
  border-bottom: 1px solid var(--tf-line);
}

.tf-hero__sky {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 55% at 12% 0%, rgba(241, 138, 31, 0.22), transparent 55%),
    radial-gradient(ellipse 65% 50% at 90% 15%, rgba(43, 125, 233, 0.28), transparent 55%),
    radial-gradient(ellipse 90% 60% at 50% 100%, rgba(11, 31, 58, 0.08), transparent 55%),
    linear-gradient(180deg, #f7fafc 0%, #e4eef8 55%, #d9e6f4 100%);
  animation: tf-sky-drift 18s ease-in-out infinite alternate;
}

.tf-hero__sky::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.55;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 22%, var(--tf-navy), transparent),
    radial-gradient(1px 1px at 28% 68%, var(--tf-blue), transparent),
    radial-gradient(1.5px 1.5px at 61% 18%, var(--tf-navy), transparent),
    radial-gradient(1px 1px at 78% 42%, var(--tf-orange), transparent),
    radial-gradient(1px 1px at 88% 76%, var(--tf-navy), transparent),
    radial-gradient(1.5px 1.5px at 42% 84%, var(--tf-blue), transparent),
    radial-gradient(1px 1px at 8% 90%, var(--tf-navy), transparent);
  animation: tf-twinkle 7s ease-in-out infinite alternate;
}

.tf-hero__inner {
  max-width: 52rem;
  margin: 0 auto;
  text-align: center;
  opacity: 1;
  animation: tf-rise 0.65s ease-out;
}

.tf-hero__brand {
  display: block;
  width: min(14rem, 55vw);
  height: auto;
  margin: 0 auto 0.85rem;
  filter: drop-shadow(0 8px 18px rgba(11, 31, 58, 0.1));
}

.tf-hero__headline {
  margin: 0 0 0.55rem;
  font-size: clamp(1.65rem, 3.4vw, 2.35rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--tf-navy);
}

.tf-hero__lede {
  margin: 0 auto 1.35rem;
  max-width: 34rem;
  font-size: clamp(1.02rem, 1.8vw, 1.18rem);
  line-height: 1.45;
  color: var(--tf-muted);
}

.tf-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.tf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.55rem;
  padding: 0.55rem 1.15rem;
  border-radius: 0.35rem;
  font-family: "Space Grotesk", var(--md-text-font);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none !important;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease,
    border-color 0.18s ease;
}

.tf-btn:hover {
  transform: translateY(-1px);
}

.tf-btn--primary {
  background: var(--tf-orange);
  color: #1a1208 !important;
}

.tf-btn--primary:hover {
  background: #ff9d35;
}

.tf-btn--ghost {
  background: rgba(255, 255, 255, 0.55);
  color: var(--tf-navy) !important;
  border: 1px solid rgba(11, 31, 58, 0.2);
}

.tf-btn--ghost:hover {
  border-color: rgba(11, 31, 58, 0.45);
  background: #fff;
}

.tf-hero__code {
  display: block;
  width: min(36rem, 100%);
  margin: 0 auto;
  text-align: left;
  padding: 1rem 1.15rem;
  border-radius: 0.4rem;
  border: 1px solid rgba(11, 31, 58, 0.14);
  background: rgba(11, 31, 58, 0.94);
  color: #d7e4f5;
  font-family: var(--md-code-font);
  font-size: 0.84rem;
  line-height: 1.55;
  overflow-x: auto;
  box-shadow: 0 18px 40px rgba(11, 31, 58, 0.18);
}

.tf-hero__code code {
  background: transparent;
  color: inherit;
  font-size: inherit;
  box-shadow: none;
}

@keyframes tf-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tf-sky-drift {
  from {
    transform: scale(1) translate3d(0, 0, 0);
  }
  to {
    transform: scale(1.04) translate3d(-1.2%, 0.8%, 0);
  }
}

@keyframes tf-twinkle {
  from {
    opacity: 0.3;
  }
  to {
    opacity: 0.55;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tf-hero__inner,
  .tf-hero__sky,
  .tf-hero__sky::after,
  .tf-btn {
    animation: none !important;
    transition: none !important;
  }
}

/* Homepage: full-bleed hero, no sidebars crowding the composition */
body[data-md-url="/"] .md-main__inner,
body[data-md-url="./"] .md-main__inner,
.md-typeset:has(.tf-below) {
  /* fallbacks below */
}

/* Hide sidebars when the landing template is active */
.md-container:has(.tf-hero) > .md-main .md-sidebar {
  display: none;
}

.md-container:has(.tf-hero) > .md-main .md-main__inner {
  margin-top: 0;
}

.md-container:has(.tf-hero) > .md-main .md-content {
  max-width: 52rem;
  margin-inline: auto;
}

.md-container:has(.tf-hero) .md-header {
  position: initial;
  background: rgba(247, 250, 252, 0.92);
  color: var(--tf-navy);
  box-shadow: none;
  backdrop-filter: blur(8px);
}

.md-container:has(.tf-hero) .md-header--shadow {
  box-shadow: none;
}

.md-container:has(.tf-hero) .md-tabs {
  background: rgba(228, 238, 248, 0.95);
  color: var(--tf-navy);
}

/* ── Below-the-fold landing body ────────────────────────────── */

.tf-below {
  padding-top: 0.25rem;
}

.tf-below > h1:first-child {
  display: none; /* brand lives in the hero */
}

.md-typeset .tf-paths {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.85rem;
  margin: 1.25rem 0 1.75rem;
  padding: 0;
  list-style: none;
}

.md-typeset .tf-paths > li {
  margin: 0;
  padding: 1rem 1.05rem;
  border: 1px solid var(--tf-line);
  border-radius: 0.4rem;
  background: var(--tf-paper);
}

.md-typeset .tf-paths a {
  font-family: "Space Grotesk", var(--md-text-font);
  font-weight: 600;
  color: var(--tf-navy);
}

[data-md-color-scheme="slate"] .md-typeset .tf-paths a {
  color: #f0f5fb;
}

.md-typeset .tf-paths p {
  margin: 0.35rem 0 0;
  color: var(--tf-muted);
  font-size: 0.92rem;
}

/* Speed table highlights */
.speed-highlight {
  font-weight: 600;
  color: var(--tf-blue);
}

.md-typeset h2 {
  border-bottom: 2px solid color-mix(in srgb, var(--tf-blue) 45%, transparent);
  padding-bottom: 0.3rem;
}

.md-footer {
  font-size: 0.8rem;
}

.md-typeset pre > code {
  font-size: 0.82rem;
}

.grid.cards > ul > li {
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.grid.cards > ul > li:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--tf-orange) 55%, var(--tf-line));
}

/* KaTeX / Arithmatex spacing */
.md-typeset .katex-display {
  margin: 1.1em 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.md-typeset span.arithmatex,
.md-typeset div.arithmatex {
  font-size: 1.02em;
}
