/* ============================================================
   PyFly — landing page styles
   Cosmic-green identity: dark sky, green fireflies, Maven Pro wordmark.
   Palette + motifs mirror assets/ (banner.svg, brand diagrams).
   ============================================================ */

:root {
  /* sky */
  --sky-0: #07110b;
  --sky-1: #0a1410;
  --sky-2: #0c1a0f;
  /* surfaces & lines */
  --surface: #0e1812;
  --surface-2: #102018;
  --line: rgba(126, 211, 33, 0.16);
  --line-soft: rgba(233, 242, 226, 0.09);
  /* greens */
  --lime: #7ed321;
  --green: #4cbb2f;
  --green-2: #43b02a;
  --green-deep: #1f5e16;
  /* firefly glow */
  --glow-a: #9bd24a;
  --glow-b: #c2e85f;
  --glow-c: #dff58a;
  /* warm accent (from diagram palette) */
  --amber: #e0a45c;
  /* ink */
  --ink: #e9f2e2;
  --ink-2: #bacbb0;
  --ink-3: #85957e;
  /* light panel (for embedded diagrams) */
  --panel: #f4f9ee;
  --panel-ink: #33402e;
  --panel-line: #dfe7d4;

  --font-display: "Maven Pro", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --maxw: 1120px;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.8);
  --glow-shadow: 0 0 40px -8px rgba(126, 211, 33, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

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

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.12; letter-spacing: -0.01em; }

a { color: var(--lime); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--glow-c); }

img { max-width: 100%; display: block; }

code { font-family: var(--font-mono); font-size: 0.92em; }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 200;
  background: var(--lime); color: #04220a; padding: 10px 16px; border-radius: 8px; font-weight: 700;
}
.skip-link:focus { left: 12px; }

:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.center { text-align: center; }

/* ============================== NAV ============================== */
.nav {
  position: sticky; top: 0; z-index: 100;
  transition: background 0.25s ease, border-color 0.25s ease, backdrop-filter 0.25s ease;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: rgba(7, 17, 11, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--line);
}
.nav__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; gap: 28px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-family: var(--font-display); font-weight: 800; font-size: 1.32rem; }
.brand:hover { color: var(--ink); }
.brand__spark {
  width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle, var(--glow-c) 0%, var(--lime) 45%, rgba(76, 187, 47, 0) 72%);
  box-shadow: 0 0 12px 2px rgba(194, 232, 95, 0.7);
}
.brand__word { letter-spacing: -0.02em; }
.brand__word-cap { color: var(--lime); }

.nav__links { display: flex; gap: 26px; margin-left: 4px; }
.nav__links a { color: var(--ink-2); font-size: 0.95rem; font-weight: 500; }
.nav__links a:hover { color: var(--ink); }
.nav__links a.is-current { color: var(--lime); }
.nav__actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.ghlink { color: var(--ink-2); display: inline-flex; }
.ghlink:hover { color: var(--lime); }

.nav__burger { display: none; background: none; border: 0; cursor: pointer; padding: 8px; flex-direction: column; gap: 5px; }
.nav__burger span { width: 22px; height: 2px; background: var(--ink); border-radius: 2px; transition: 0.2s; }

/* ============================== BUTTONS ============================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 22px; border-radius: 999px; font-weight: 700; font-size: 0.96rem;
  font-family: var(--font-display); cursor: pointer; border: 1px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: linear-gradient(135deg, #b6f06a 0%, var(--lime) 45%, var(--green-2) 100%);
  color: #06250b; box-shadow: var(--glow-shadow);
}
.btn--primary:hover { color: #06250b; box-shadow: 0 0 52px -6px rgba(126, 211, 33, 0.55); transform: translateY(-1px); }
.btn--ghost { background: rgba(233, 242, 226, 0.04); color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { color: var(--ink); border-color: var(--lime); background: rgba(126, 211, 33, 0.08); }

/* ============================== HERO ============================== */
.hero { position: relative; padding: 96px 0 88px; overflow: hidden; }
.hero__sky { position: absolute; inset: 0; z-index: 0; background: linear-gradient(135deg, var(--sky-0) 0%, var(--sky-1) 50%, var(--sky-2) 100%); }
.hero__ambient {
  position: absolute; top: -180px; right: -120px; width: 760px; height: 760px;
  background: radial-gradient(circle, rgba(76, 187, 47, 0.22) 0%, rgba(126, 211, 33, 0.07) 48%, rgba(126, 211, 33, 0) 72%);
  pointer-events: none;
}
.hero::after { /* bottom fade into page */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 160px; z-index: 1;
  background: linear-gradient(to bottom, rgba(7, 17, 11, 0), var(--sky-0)); pointer-events: none;
}
.hero__content { position: relative; z-index: 2; max-width: 880px; margin: 0 auto; padding: 0 24px; text-align: center; }

.pill {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 16px; border-radius: 999px; font-size: 0.85rem; font-weight: 600;
  color: var(--ink-2); background: rgba(126, 211, 33, 0.07); border: 1px solid var(--line);
}
.pill:hover { color: var(--ink); }
.pill__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--glow-b); box-shadow: 0 0 10px 1px var(--glow-b); }

.hero__title { margin: 26px 0 8px; }
.wordmark {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(4rem, 13vw, 8.5rem);
  line-height: 0.95; letter-spacing: -0.03em;
  background: linear-gradient(180deg, #b6f06a 0%, var(--lime) 50%, var(--green-2) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 30px rgba(126, 211, 33, 0.25));
}
.wordmark__cap { -webkit-text-fill-color: #eaf6d6; color: #eaf6d6; }

.hero__tagline { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.5rem, 3.4vw, 2.1rem); margin: 6px 0 18px; color: var(--ink); }
.accent { color: var(--lime); }
.hero__sub { font-size: clamp(1.02rem, 1.8vw, 1.18rem); color: var(--ink-2); max-width: 660px; margin: 0 auto 32px; }

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

.install {
  margin: 34px auto 0; max-width: 660px;
  display: flex; align-items: flex-start; gap: 12px;
  background: rgba(4, 10, 6, 0.6); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 12px 12px 16px;
}
.install__code { color: var(--ink); font-size: 0.85rem; flex: 1; text-align: left; white-space: normal; overflow-wrap: anywhere; line-height: 1.65; }
.install__prompt { color: var(--lime); margin-right: 10px; user-select: none; }
.install__copy {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; flex: none; align-self: flex-start;
  background: rgba(126, 211, 33, 0.1); color: var(--ink); border: 1px solid var(--line);
  border-radius: 7px; padding: 8px 12px; font-size: 0.82rem; font-weight: 600; font-family: var(--font-display);
  transition: 0.15s;
}
.install__copy:hover { background: rgba(126, 211, 33, 0.2); border-color: var(--lime); }
.install__copy.is-copied { color: var(--lime); }

.hero__badges { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 28px; }
.badge {
  font-family: var(--font-mono); font-size: 0.76rem; color: var(--ink-2);
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-soft); background: rgba(233, 242, 226, 0.03);
}
.badge--ver { color: var(--lime); border-color: var(--line); }

/* ============================== FIREFLIES ============================== */
.fireflies { position: absolute; inset: 0; pointer-events: none; }
.firefly {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, var(--glow-c) 0%, var(--glow-a) 45%, rgba(155, 210, 74, 0) 70%);
  opacity: 0; will-change: transform, opacity;
  animation: ff-drift var(--d, 14s) ease-in-out infinite, ff-flicker calc(var(--d, 14s) / 3.5) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
@keyframes ff-drift {
  0%   { transform: translate(0, 0); }
  50%  { transform: translate(var(--dx, 20px), calc(var(--dy, -50px))); }
  100% { transform: translate(0, 0); }
}
@keyframes ff-flicker {
  0%, 100% { opacity: 0.15; }
  50%      { opacity: var(--peak, 0.85); }
}

/* ============================== SECTIONS ============================== */
.section { padding: 84px 0; position: relative; }
.section--tint { background: linear-gradient(180deg, var(--sky-0), var(--surface) 50%, var(--sky-0)); }
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.78rem; font-weight: 700;
  color: var(--lime); margin: 0 0 14px;
}
.eyebrow::before { content: "◆ "; color: var(--green-2); }
.section__title { font-size: clamp(1.8rem, 4vw, 2.7rem); margin: 0 0 20px; max-width: 18ch; }
#why .section__title, #code .section__title { max-width: 22ch; }
.lede { font-size: clamp(1.04rem, 1.6vw, 1.18rem); color: var(--ink-2); max-width: 70ch; margin: 0 0 38px; }
.lede strong { color: var(--ink); }

/* ============================== WHY ============================== */
.why-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.why-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 26px; position: relative; overflow: hidden;
}
.why-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--lime), rgba(126, 211, 33, 0));
}
.why-card__num { font-family: var(--font-mono); font-size: 0.9rem; color: var(--green-deep); font-weight: 700;
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  background: rgba(126, 211, 33, 0.12); color: var(--glow-c); margin-bottom: 16px; }
.why-card h3 { font-size: 1.2rem; margin: 0 0 8px; }
.why-card p { color: var(--ink-2); margin: 0; font-size: 0.98rem; }
.why-card code, .phil-card code, .step__note code { color: var(--glow-c); background: rgba(126, 211, 33, 0.1); padding: 1px 6px; border-radius: 5px; }

/* ============================== CODE PANEL ============================== */
.code-panel { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #060d08; box-shadow: var(--shadow); }
.code-top { display: flex; align-items: stretch; gap: 14px; background: rgba(0, 0, 0, 0.35); padding-left: 18px; border-bottom: 1px solid var(--line-soft); }
.code-dots { display: inline-flex; align-items: center; gap: 7px; }
.code-dots i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.code-dots i:nth-child(1) { background: #5a4326; }
.code-dots i:nth-child(2) { background: #4f4a22; }
.code-dots i:nth-child(3) { background: #275024; }
.code-tabs { display: flex; gap: 2px; padding: 8px 8px 0; overflow-x: auto; flex: 1; }
.code-tab {
  background: none; border: 0; cursor: pointer; color: var(--ink-3); font-family: var(--font-display); font-weight: 600;
  font-size: 0.92rem; padding: 11px 18px; border-radius: 9px 9px 0 0; white-space: nowrap; transition: 0.15s;
}
.code-tab:hover { color: var(--ink-2); }
.code-tab.is-active { color: var(--ink); background: #060d08; box-shadow: inset 0 2px 0 var(--lime); }
.code-body { display: none; }
.code-body.is-active { display: block; }
.code-body pre { margin: 0; padding: 24px 26px; overflow-x: auto; font-size: 0.86rem; line-height: 1.7; }
.code-body code { font-family: var(--font-mono); color: #cdddc2; }

/* syntax tokens (green-forward, amber strings) */
.c-kw  { color: #8fe34a; }
.c-dec { color: var(--glow-c); font-weight: 600; }
.c-str { color: var(--amber); }
.c-com { color: #6b7d62; font-style: italic; }
.c-fn  { color: #b6f06a; }
.c-cls { color: #eaf6d6; }
.c-num { color: #d6e89a; }
.c-self { color: var(--ink-3); font-style: italic; }

/* ============================== PHILOSOPHY ============================== */
.phil-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.phil-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; transition: border-color 0.2s ease, transform 0.2s ease; }
.phil-card:hover { border-color: var(--lime); transform: translateY(-2px); }
.phil-card h3 { font-size: 1.18rem; margin: 0 0 10px; color: var(--lime); }
.phil-card p { color: var(--ink-2); margin: 0; }

/* ============================== FIGURES ============================== */
.figure { margin: 0 0 18px; background: var(--panel); border: 1px solid var(--panel-line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.figure img { margin: 0 auto; }
.figure figcaption { margin-top: 14px; text-align: center; color: var(--panel-ink); font-size: 0.9rem; font-weight: 600; }
.figure-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.figure-note { text-align: center; margin: 8px 0 0; }
.figure-note a { font-weight: 700; font-family: var(--font-display); }

/* ============================== PATTERNS ============================== */
.pat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 8px; }
.pat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; display: flex; flex-direction: column; transition: border-color 0.2s, transform 0.2s; }
.pat-card:hover { border-color: var(--lime); transform: translateY(-2px); }
.pat-card h3 { font-size: 1.16rem; margin: 0 0 10px; }
.pat-card p { color: var(--ink-2); margin: 0 0 16px; font-size: 0.96rem; flex: 1; }
.pat-card a { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 600; }

/* ============================== MODULES / LAYERS ============================== */
.layers { display: flex; flex-direction: column; gap: 14px; }
.layer { display: grid; grid-template-columns: 160px 1fr; gap: 18px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; }
.layer__label { font-family: var(--font-display); font-weight: 700; color: var(--lime); font-size: 1.02rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-2); background: rgba(233, 242, 226, 0.04); border: 1px solid var(--line-soft); border-radius: 7px; padding: 4px 10px; transition: 0.15s; }
.chip:hover { color: var(--glow-c); border-color: var(--line); background: rgba(126, 211, 33, 0.08); }

/* ============================== QUICKSTART ============================== */
.steps { list-style: none; margin: 0 0 36px; padding: 0; display: flex; flex-direction: column; gap: 18px; max-width: 820px; }
.step { display: flex; gap: 18px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; }
.step__num { flex: none; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; color: #06250b; background: linear-gradient(135deg, var(--glow-c), var(--lime)); }
.step__body { flex: 1; min-width: 0; }
.step__body h3 { font-size: 1.08rem; margin: 4px 0 12px; }
.step__note { color: var(--ink-3); font-size: 0.9rem; margin: 10px 0 0; }
.mini-code { display: flex; align-items: center; gap: 10px; background: #060d08; border: 1px solid var(--line-soft); border-radius: 9px; padding: 10px 12px; overflow-x: auto; }
.mini-code code { color: var(--ink); white-space: nowrap; flex: 1; }
.mini-copy { flex: none; cursor: pointer; background: none; border: 0; color: var(--ink-3); font-size: 1rem; padding: 2px 6px; border-radius: 6px; transition: 0.15s; }
.mini-copy:hover { color: var(--lime); background: rgba(126, 211, 33, 0.1); }
.mini-copy.is-copied { color: var(--lime); }

/* ============================== BOOK ============================== */
.section--book { background: linear-gradient(180deg, var(--sky-0), #0a160d 50%, var(--sky-0)); }
.book { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 48px; align-items: center; }
.book__text .section__title { max-width: none; }
.book__art { display: grid; place-items: center; }
.book__cover {
  width: 230px; height: 320px; border-radius: 12px; position: relative; overflow: hidden;
  background: linear-gradient(155deg, var(--sky-1) 0%, #0c2012 60%, #0a3015 100%);
  border: 1px solid var(--line); box-shadow: var(--shadow), inset 0 0 60px rgba(76, 187, 47, 0.12);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  transform: rotate(-4deg); transition: transform 0.3s ease;
}
.book__cover:hover { transform: rotate(0deg) scale(1.02); }
.book__cover-spark { width: 16px; height: 16px; border-radius: 50%; margin-bottom: 14px;
  background: radial-gradient(circle, var(--glow-c), var(--lime) 50%, rgba(76, 187, 47, 0) 72%);
  box-shadow: 0 0 22px 3px rgba(194, 232, 95, 0.7); }
.book__cover-title { font-family: var(--font-display); font-weight: 800; font-size: 2.6rem; letter-spacing: -0.03em;
  background: linear-gradient(180deg, #b6f06a, var(--lime)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.book__cover-title .wordmark__cap { -webkit-text-fill-color: #eaf6d6; color: #eaf6d6; }
.book__cover-sub { font-family: var(--font-display); color: var(--ink-2); font-size: 1rem; letter-spacing: 0.04em; }

/* ============================== CTA BAND ============================== */
.cta-band { position: relative; padding: 92px 0; overflow: hidden; text-align: center; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cta-band__sky { position: absolute; inset: 0; background: radial-gradient(ellipse at center, #0d1d12 0%, var(--sky-0) 75%); }
.cta-band__inner { position: relative; z-index: 2; }
.cta-band h2 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); margin: 0 0 28px; max-width: 20ch; margin-inline: auto; }

/* ============================== FOOTER ============================== */
.footer { background: var(--sky-0); padding: 64px 0 48px; border-top: 1px solid var(--line-soft); }
.footer__inner { display: grid; grid-template-columns: 1.4fr 2fr; gap: 48px; }
.footer__brand .brand__word { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; color: var(--ink); }
.footer__brand .brand__word-cap { color: var(--lime); }
.footer__brand p { color: var(--ink-3); font-size: 0.92rem; max-width: 36ch; margin: 12px 0 0; }
.footer__copy { font-size: 0.82rem !important; }
.footer__cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.footer__col h4 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); margin: 0 0 14px; }
.footer__col a { display: block; color: var(--ink-2); font-size: 0.92rem; padding: 5px 0; }
.footer__col a:hover { color: var(--lime); }

/* ============================== REVEAL ============================== */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ============================== STATS BAND ============================== */
.stats {
  border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--sky-0), var(--surface) 50%, var(--sky-0));
}
.stats__inner { display: flex; flex-wrap: wrap; justify-content: space-around; gap: 24px; padding: 32px 24px; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 120px; }
.stat__num {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(1.9rem, 4vw, 2.7rem); line-height: 1;
  background: linear-gradient(180deg, #b6f06a, var(--lime)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat__label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.13em; color: var(--ink-3); }

/* ============================== RESPONSIVE ============================== */
@media (max-width: 900px) {
  .why-grid, .pat-grid { grid-template-columns: 1fr 1fr; }
  .footer__inner { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 760px) {
  .nav__links { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0;
    background: rgba(7, 17, 11, 0.97); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); padding: 8px 0; }
  .nav.is-open .nav__links { display: flex; }
  .nav__links a { padding: 14px 24px; }
  .nav__burger { display: flex; }
  .why-grid, .phil-grid, .pat-grid, .figure-pair { grid-template-columns: 1fr; }
  .stat { min-width: 40%; }
  .layer { grid-template-columns: 1fr; gap: 12px; }
  .book { grid-template-columns: 1fr; gap: 32px; }
  .book__art { order: -1; }
  .section { padding: 64px 0; }
  .hero { padding: 64px 0 56px; }
}

/* ============================== MOTION PREFERENCES ============================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .firefly { animation: none; opacity: 0.55; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .phil-card, .pat-card, .book__cover { transition: none; }
}
