/* =============================================================================
   Firefly Agentic — brand stylesheet
   Loaded site-wide. Two responsibilities, kept separate:
     1. Docs theme: recolor Material to the exact violet brand (both schemes).
     2. Landing page: the immersive "firefly-in-the-dark" home, scoped under
        .ff-home so nothing leaks into the docs.
   Brand tokens are lifted verbatim from assets/README.md.
   ========================================================================== */

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

:root {
  /* Night sky */
  --ff-sky-0: #0b0a14;
  --ff-sky-1: #120d1c;
  --ff-sky-2: #140f1e;
  --ff-ink:   #1e1633;
  /* Violet system */
  --ff-violet:        #8b5cf6;
  --ff-violet-bright: #a78bfa;
  --ff-violet-2:      #7c3aed;
  --ff-violet-deep:   #4c1d95;
  --ff-violet-pale:   #d6c6ff;
  /* The one warm spark — the shared firefly */
  --ff-amber:      #f6a821;
  --ff-amber-hot:  #f68000;
  --ff-amber-pale: #fff9c1;
  /* Text on dark */
  --ff-fg:    #ece8f5;
  --ff-muted: #b3a9cd;
  --ff-faint: #8b82a3;
  /* Surfaces */
  --ff-card:    rgba(139, 92, 246, 0.05);
  --ff-card-2:  rgba(167, 139, 250, 0.08);
  --ff-card-bd: rgba(167, 139, 250, 0.16);
  --ff-card-bd-hot: rgba(167, 139, 250, 0.42);
  /* Gradients */
  --ff-wm:  linear-gradient(92deg, #d6c6ff 0%, #a78bfa 48%, #7c3aed 100%);
  --ff-amber-grad: radial-gradient(circle at 50% 42%, #fffdf0, #fff6b0 45%, #f68000 100%);
  --ff-header-h: 2.9rem;
  --ff-display: "Space Grotesk", "Inter", system-ui, sans-serif;
}

/* =============================================================================
   1. DOCS — recolor Material to the brand (does not touch .ff-home)
   ========================================================================== */

[data-md-color-scheme="default"] {
  --md-primary-fg-color:        #6d28d9;
  --md-primary-fg-color--light: #8b5cf6;
  --md-primary-fg-color--dark:  #5b21b6;
  --md-accent-fg-color:         #7c3aed;
  --md-typeset-a-color:         #7c3aed;
}

/* Slate, tinted toward violet so the dark docs feel like the same night sky. */
[data-md-color-scheme="slate"] {
  --md-hue: 264;
  --md-primary-fg-color:        #1c142e;
  --md-primary-fg-color--light: #2a1f45;
  --md-primary-fg-color--dark:  #140e22;
  --md-accent-fg-color:         #a78bfa;
  --md-typeset-a-color:         #b89cff;
  --md-default-bg-color:        hsla(264, 24%, 9%, 1);
}

/* Display face for all headings, in docs and on the landing. */
.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-header__title {
  font-family: var(--ff-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Brand-tinted code accents in docs admonitions/inline (subtle). */
.md-typeset :not(pre) > code {
  border-radius: 0.25rem;
}

/* =============================================================================
   2. LANDING — everything scoped under .ff-home (or body:has)
   ========================================================================== */

/* Force the night sky behind the whole home document, both schemes, and hide
   the empty Material main/sidebars (the landing lives in the tabs block). */
body:has(.ff-home),
body:has(.ff-home) .md-container {
  background-color: var(--ff-sky-0);
}
body:has(.ff-home) .md-main { display: none; }
body:has(.ff-home) .md-tabs { display: none; }

/* Transparent header that melts into the hero, then solidifies on scroll. */
body:has(.ff-home) .md-header {
  background-color: transparent;
  box-shadow: none;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}
body:has(.ff-home) .md-header--shadow {
  background-color: rgba(11, 10, 20, 0.82);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 rgba(167, 139, 250, 0.14);
}

.ff-home {
  color: var(--ff-fg);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow: hidden; /* contain the hero glows */
}
.ff-home *,
.ff-home *::before,
.ff-home *::after { box-sizing: border-box; }

.ff-home a { text-decoration: none; }

.ff-wrap {
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.ff-eyebrow {
  font-family: var(--ff-display);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ff-violet-bright);
  margin: 0 0 1.1rem;
}

.ff-grad {
  background: var(--ff-wm);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---- Hero -------------------------------------------------------------- */
.ff-hero {
  position: relative;
  padding-top: calc(var(--ff-header-h) + 5.5rem);
  padding-bottom: 6rem;
  text-align: center;
  isolation: isolate;
}
.ff-constellation {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  display: block;
}
.ff-hero::before { /* layered violet ambient, echoing the banner */
  content: "";
  position: absolute;
  inset: -20% -10% 0;
  z-index: -1;
  background:
    radial-gradient(60% 55% at 22% 18%, rgba(124, 58, 237, 0.28), transparent 60%),
    radial-gradient(60% 55% at 82% 10%, rgba(99, 102, 241, 0.22), transparent 60%),
    radial-gradient(45% 40% at 50% 90%, rgba(76, 29, 149, 0.30), transparent 70%);
  pointer-events: none;
}

.ff-hero__title {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  margin: 0 auto 1.3rem;
  max-width: 16ch;
}
.ff-hero__lead {
  font-size: clamp(1.05rem, 1.6vw, 1.28rem);
  color: var(--ff-muted);
  max-width: 60ch;
  margin: 0 auto 2.2rem;
}
.ff-hero__lead code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.92em;
  color: var(--ff-violet-pale);
  background: rgba(167, 139, 250, 0.12);
  padding: 0.08em 0.4em;
  border-radius: 0.3rem;
}

/* Install command */
.ff-install {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  max-width: min(100%, 720px);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.84rem;
  color: var(--ff-fg);
  background: rgba(20, 15, 30, 0.72);
  border: 1px solid var(--ff-card-bd);
  border-radius: 0.6rem;
  padding: 0.65rem 0.65rem 0.65rem 1rem;
  margin-bottom: 2.2rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  text-align: left;
}
.ff-install__prompt { color: var(--ff-amber); user-select: none; flex: 0 0 auto; }
.ff-install__cmd {
  color: var(--ff-fg);
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}
.ff-install__cmd::-webkit-scrollbar { height: 4px; }
.ff-install__copy {
  display: inline-grid;
  place-items: center;
  width: 2rem; height: 2rem;
  border: 0;
  border-radius: 0.4rem;
  background: rgba(167, 139, 250, 0.14);
  color: var(--ff-violet-bright);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.ff-install__copy:hover { background: rgba(167, 139, 250, 0.28); color: #fff; }
.ff-install__copy svg { width: 1rem; height: 1rem; }
.ff-install__copy.is-copied { background: rgba(111, 207, 114, 0.22); color: #6fcf72; }
.ff-install__copy.is-copied svg { display: none; }
.ff-install__copy.is-copied::after { content: "\2713"; font-size: 1rem; line-height: 1; } /* check mark */

/* CTAs */
.ff-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
}
.ff-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.72rem 1.4rem;
  border-radius: 0.6rem;
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.ff-btn svg { width: 1.05rem; height: 1.05rem; }
.ff-btn--primary {
  color: #fff;
  background: linear-gradient(180deg, #8b5cf6, #7c3aed);
  box-shadow: 0 10px 28px rgba(124, 58, 237, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.ff-btn--primary:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(124, 58, 237, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.ff-btn--ghost {
  color: var(--ff-fg);
  background: rgba(167, 139, 250, 0.06);
  border-color: var(--ff-card-bd);
}
.ff-btn--ghost:hover { background: rgba(167, 139, 250, 0.16); border-color: var(--ff-card-bd-hot); transform: translateY(-2px); }

/* ---- Trust bar --------------------------------------------------------- */
.ff-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem 0.7rem;
  padding-bottom: 3rem;
}
.ff-chip {
  font-family: var(--ff-display);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ff-muted);
  background: var(--ff-card);
  border: 1px solid var(--ff-card-bd);
  border-radius: 999px;
  padding: 0.38rem 0.9rem;
}
.ff-chip b { color: var(--ff-violet-bright); font-weight: 700; }
.ff-chip--amber { color: #ffce7a; }
.ff-chip--amber b { color: var(--ff-amber); }

/* ---- Section scaffold -------------------------------------------------- */
.ff-section { padding-block: 4.5rem; position: relative; }
.ff-section--tint {
  background: linear-gradient(180deg, transparent, rgba(124, 58, 237, 0.05) 40%, transparent);
}
.ff-section__head { max-width: 62ch; margin: 0 auto 2.6rem; text-align: center; }
.ff-section__kicker {
  font-family: var(--ff-display);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ff-amber);
  display: block;
  margin-bottom: 0.7rem;
}
.ff-section__title {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 0.8rem;
}
.ff-section__sub { color: var(--ff-muted); font-size: 1.05rem; margin: 0; }

/* ---- "Why" split ------------------------------------------------------- */
.ff-why {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2.5rem;
  align-items: center;
}
.ff-why__title {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin: 0 0 1.1rem;
}
.ff-why p { color: var(--ff-muted); margin: 0 0 1.4rem; }
.ff-why__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; }
.ff-why__list li { position: relative; padding-left: 1.7rem; color: var(--ff-fg); }
.ff-why__list li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.45em;
  width: 0.55rem; height: 0.55rem;
  border-radius: 50%;
  background: var(--ff-amber-grad);
  box-shadow: 0 0 10px 1px rgba(246, 168, 33, 0.6);
}
.ff-why__list b { color: var(--ff-violet-bright); font-weight: 600; }

/* ---- Feature grid ------------------------------------------------------ */
.ff-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.ff-feat {
  position: relative;
  display: block;
  background: var(--ff-card);
  border: 1px solid var(--ff-card-bd);
  border-radius: 0.8rem;
  padding: 1.4rem 1.4rem 1.5rem;
  transition: transform 0.18s ease, border-color 0.2s ease, background 0.2s ease;
}
.ff-feat::after { /* firefly dot, the recurring mark */
  content: "";
  position: absolute;
  top: 1.4rem; right: 1.4rem;
  width: 0.5rem; height: 0.5rem;
  border-radius: 50%;
  background: var(--ff-amber-grad);
  opacity: 0.5;
  box-shadow: 0 0 8px 1px rgba(246, 168, 33, 0.5);
  transition: opacity 0.2s ease, box-shadow 0.2s ease;
}
.ff-feat:hover {
  transform: translateY(-3px);
  border-color: var(--ff-card-bd-hot);
  background: var(--ff-card-2);
}
.ff-feat:hover::after { opacity: 1; box-shadow: 0 0 14px 2px rgba(246, 168, 33, 0.8); }
.ff-feat__name {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: 1.08rem;
  color: var(--ff-fg);
  margin: 0 0 0.4rem;
}
.ff-feat__desc { color: var(--ff-muted); font-size: 0.92rem; margin: 0; }

/* ---- Diagram frame ----------------------------------------------------- */
.ff-figure {
  background: rgba(245, 242, 254, 0.96);
  border: 1px solid var(--ff-card-bd);
  border-radius: 1rem;
  padding: 1.4rem;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.ff-figure img { display: block; width: 100%; height: auto; }
.ff-figure--pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; background: none; border: 0; box-shadow: none; padding: 0; }
.ff-figure--pair > .ff-figure { margin: 0; }
.ff-figcap { text-align: center; color: var(--ff-faint); font-size: 0.86rem; margin-top: 1rem; }

/* ---- Pattern chips ----------------------------------------------------- */
.ff-patterns { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin-top: 2rem; }
.ff-pattern {
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--ff-fg);
  background: var(--ff-card-2);
  border: 1px solid var(--ff-card-bd);
  border-radius: 0.5rem;
  padding: 0.5rem 0.95rem;
}
.ff-pattern span { color: var(--ff-amber); }

/* ---- Code showcase (CSS-only tabs) ------------------------------------- */
.ff-code-wrap { max-width: 900px; margin-inline: auto; }
.ff-tabs { position: relative; }
.ff-tabs > input { position: absolute; opacity: 0; pointer-events: none; }
.ff-tabs__labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
  justify-content: center;
}
.ff-tabs__labels label {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--ff-muted);
  padding: 0.45rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.ff-tabs__labels label:hover { color: var(--ff-fg); }
.ff-window {
  background: #0e0b18;
  border: 1px solid var(--ff-card-bd);
  border-radius: 0.8rem;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.ff-window__bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid rgba(167, 139, 250, 0.12);
}
.ff-window__bar i { width: 0.62rem; height: 0.62rem; border-radius: 50%; display: inline-block; }
.ff-window__bar i:nth-child(1) { background: #f6705a; }
.ff-window__bar i:nth-child(2) { background: #f6a821; }
.ff-window__bar i:nth-child(3) { background: #6fcf72; }
.ff-window__file { margin-left: 0.6rem; font-family: "JetBrains Mono", monospace; font-size: 0.78rem; color: var(--ff-faint); }
.ff-panel { display: none; margin: 0; }
.ff-code {
  margin: 0;
  padding: 1.3rem 1.4rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.86rem;
  line-height: 1.7;
  color: #d8d2ea;
  overflow-x: auto;
  tab-size: 4;
}
.ff-code .k { color: #c4a8ff; }      /* keyword */
.ff-code .d { color: #f6a821; }      /* decorator */
.ff-code .s { color: #ffce7a; }      /* string */
.ff-code .c { color: var(--ff-faint); font-style: italic; } /* comment */
.ff-code .f { color: #8be9fd; }      /* call / attribute */
.ff-code .o { color: var(--ff-violet-bright); } /* operator-ish */
/* show the panel whose radio is checked + light its label */
#ff-c1:checked ~ .ff-window .ff-panel.p1,
#ff-c2:checked ~ .ff-window .ff-panel.p2,
#ff-c3:checked ~ .ff-window .ff-panel.p3,
#ff-c4:checked ~ .ff-window .ff-panel.p4 { display: block; }
#ff-c1:checked ~ .ff-tabs__labels label[for="ff-c1"],
#ff-c2:checked ~ .ff-tabs__labels label[for="ff-c2"],
#ff-c3:checked ~ .ff-tabs__labels label[for="ff-c3"],
#ff-c4:checked ~ .ff-tabs__labels label[for="ff-c4"] {
  color: #fff;
  background: rgba(124, 58, 237, 0.28);
  border-color: var(--ff-card-bd-hot);
}
.ff-tabs > input:focus-visible ~ .ff-tabs__labels label { outline: 2px solid var(--ff-violet-bright); outline-offset: 2px; }

/* ---- Learn cards ------------------------------------------------------- */
.ff-learn { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.ff-learn__card {
  display: block;
  background: var(--ff-card);
  border: 1px solid var(--ff-card-bd);
  border-radius: 0.9rem;
  padding: 1.6rem;
  transition: transform 0.18s ease, border-color 0.2s ease, background 0.2s ease;
}
.ff-learn__card:hover { transform: translateY(-3px); border-color: var(--ff-card-bd-hot); background: var(--ff-card-2); }
.ff-learn__eyebrow { font-family: var(--ff-display); font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ff-amber); }
.ff-learn__title { font-family: var(--ff-display); font-weight: 700; font-size: 1.25rem; color: var(--ff-fg); margin: 0.6rem 0 0.5rem; }
.ff-learn__desc { color: var(--ff-muted); font-size: 0.92rem; margin: 0 0 0.9rem; }
.ff-learn__more { font-family: var(--ff-display); font-weight: 600; font-size: 0.88rem; color: var(--ff-violet-bright); }
.ff-learn__card:hover .ff-learn__more { color: #fff; }

/* ---- Footer ------------------------------------------------------------ */
.ff-foot {
  border-top: 1px solid rgba(167, 139, 250, 0.14);
  padding-block: 3rem 2.4rem;
  margin-top: 2rem;
  background: linear-gradient(180deg, transparent, rgba(76, 29, 149, 0.12));
}
.ff-foot__grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 2rem; }
.ff-foot__brand { display: flex; align-items: center; gap: 0.6rem; font-family: var(--ff-display); font-weight: 700; font-size: 1.15rem; color: #fff; }
.ff-foot__brand img { width: 1.7rem; height: 1.7rem; }
.ff-foot__tag { color: var(--ff-faint); font-size: 0.9rem; margin: 0.9rem 0 0; max-width: 34ch; }
.ff-foot h4 { font-family: var(--ff-display); font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ff-violet-bright); margin: 0 0 0.9rem; }
.ff-foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.ff-foot a { color: var(--ff-muted); font-size: 0.92rem; }
.ff-foot a:hover { color: #fff; }
.ff-foot__base { border-top: 1px solid rgba(167, 139, 250, 0.1); margin-top: 2.4rem; padding-top: 1.6rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.6rem; color: var(--ff-faint); font-size: 0.84rem; }

/* ---- Scroll reveal --------------------------------------------------- */
/* Intentionally none: landing content is always visible regardless of JS.
   The hero constellation is the page's single animation. (.ff-reveal stays
   in the markup as a harmless hook.) */

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 900px) {
  .ff-grid { grid-template-columns: repeat(2, 1fr); }
  .ff-learn { grid-template-columns: 1fr; }
  .ff-why { grid-template-columns: 1fr; }
  .ff-figure--pair { grid-template-columns: 1fr; }
  .ff-foot__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .ff-grid { grid-template-columns: 1fr; }
  .ff-foot__grid { grid-template-columns: 1fr; }
  .ff-install { width: 100%; justify-content: space-between; font-size: 0.82rem; }
  .ff-hero { padding-top: calc(var(--ff-header-h) + 3rem); }
}

/* ---- Reduced motion ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .ff-home *,
  .ff-reveal { transition: none !important; animation: none !important; }
  .ff-reveal { opacity: 1; transform: none; }
}
