/* ──────────────────────────────────────────────────────────────────
   progy landing: monochrome, techno-minimal.
   Design DNA borrowed from whatleymill: light theme, Outfit display,
   centered hero, canvas tableau, vignette overlay.
   Terminal block is JetBrains Mono. progy's story is a CLI story.
   ────────────────────────────────────────────────────────────────── */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #ffffff;
  color: #1d1d1f;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

.page {
  position: fixed;
  inset: 0;
  width: 100vw;
  /* Use small-viewport-height units when supported so mobile browsers' dynamic
     URL bars don't crop the bottom of the layout when they collapse/expand. */
  height: 100vh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  /* The page itself never scrolls — that lets brand/status (absolute, top
     corners) and foot (flex-pinned bottom) stay anchored to the viewport.
     The hero takes the middle flex slot and scrolls internally. */
  overflow: hidden;
}

/* ─── Brand (top-left) ─── */
.brand {
  position: absolute;
  top: 0; left: 0;
  padding: 30px 40px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}
.brand-mark {
  width: 22px; height: 22px;
  border: 1.25px solid #1d1d1f;
  border-radius: 4px;
  display: grid;
  place-items: center;
  transform: rotate(-2deg);
}
.brand-mark svg { width: 20px; height: 20px; display: block; }
.brand-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* ─── Status pill (top-right) — live ping to {progy-api}/v1/health ─── */
.status {
  position: absolute;
  top: 0; right: 0;
  padding: 30px 40px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #86868b;
  user-select: none;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #c7cbd0;
  position: relative;
  transition: background 0.4s ease;
}
.status-dot[data-state="online"] { background: #5ee19a; }
.status-dot[data-state="online"]::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: #5ee19a;
  opacity: 0.35;
  animation: pulse 2.2s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}
.status-dot[data-state="offline"] { background: #ff6b6b; }
@keyframes pulse {
  0%   { transform: scale(0.6); opacity: 0.5; }
  100% { transform: scale(2.2); opacity: 0;   }
}

/* ─── Canvas tableau ─── */
.canvas-wrap { position: absolute; inset: 0; z-index: 1; }
canvas { display: block; width: 100%; height: 100%; }

/* ─── Top scroll shade ───
   Masks hero content as it scrolls up toward the absolute-positioned
   brand/status chrome at the top corners. Sits above the hero (z:5) but
   below the chrome (z:10) so brand/status stay crisp while scroll content
   fades to white before it reaches them. Pointer-events disabled so it
   doesn't intercept any clicks (CTAs near the top edge stay reachable). */
.page::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 88px;
  z-index: 7;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    #ffffff 0%,
    rgba(255, 255, 255, 0.94) 30%,
    rgba(255, 255, 255, 0.55) 65%,
    rgba(255, 255, 255, 0) 100%
  );
}

/* ─── Vignette: pushes the canvas detail toward the edges so it never
       fights the hero copy in the middle ─── */
.vignette {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: radial-gradient(
    ellipse 80% 70% at 50% 50%,
    rgba(255,255,255,0.94) 0%,
    rgba(255,255,255,0.72) 25%,
    transparent 55%,
    rgba(255,255,255,0.88) 100%
  );
}

/* ─── Hero ─── */
.hero {
  position: relative;
  z-index: 5;
  flex: 1 1 auto;
  /* min-height: 0 lets a flex child shrink below its content size, which is
     what enables nested overflow-y: auto to actually scroll. Without it the
     hero just pushes the foot off-screen instead of scrolling internally. */
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* `safe center` falls back to start-alignment when content would overflow,
     keeping the top of the content reachable via scroll. Plain `center`
     centers the overflow on both sides — top becomes unreachable. */
  justify-content: safe center;
  text-align: center;
  padding: 96px 24px 48px;
}
.hero-inner {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #86868b;
  margin-bottom: 28px;
  opacity: 0; transform: translateY(12px);
  animation: rise 1s cubic-bezier(0.16,1,0.3,1) 0.25s forwards;
}
.eyebrow .sep { color: #c7cbd0; padding: 0 10px; }

.hero-title {
  font-size: clamp(36px, 5.4vw, 68px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.04;
  color: #1d1d1f;
}
.hero-title .line1 {
  display: block;
  opacity: 0; transform: translateY(24px);
  animation: rise 1s cubic-bezier(0.16,1,0.3,1) 0.4s forwards;
}
.hero-title .line2 {
  display: block;
  opacity: 0; transform: translateY(24px);
  animation: rise 1s cubic-bezier(0.16,1,0.3,1) 0.55s forwards;
}
.hero-title .accent {
  background: linear-gradient(135deg, #1d1d1f 0%, #3a3a3c 60%, #1d1d1f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.04em;
}

.hero-sub {
  margin-top: 28px;
  max-width: 580px;
  font-size: 15px;
  font-weight: 300;
  line-height: 1.6;
  color: #4a4a4f;
  opacity: 0; transform: translateY(16px);
  animation: rise 1s cubic-bezier(0.16,1,0.3,1) 0.75s forwards;
}
.hero-noscript {
  margin-top: 14px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #1d1d1f;
  opacity: 0; transform: translateY(16px);
  animation: rise 1s cubic-bezier(0.16,1,0.3,1) 0.9s forwards;
}
.hero-noscript .dot { color: #c7cbd0; padding: 0 8px; }

/* ─── Meta strip (providers + rails) ─── */
.meta {
  margin-top: 36px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 18px;
  font-size: 12px;
  text-align: left;
  opacity: 0; transform: translateY(16px);
  animation: rise 1s cubic-bezier(0.16,1,0.3,1) 1.05s forwards;
}
.meta dt {
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #86868b;
  align-self: center;
}
.meta dt::after {
  content: '';
  display: inline-block;
  width: 22px;
  height: 1px;
  background: #c7cbd0;
  vertical-align: middle;
  margin-left: 10px;
}
.meta dd {
  color: #1d1d1f;
  font-weight: 400;
  letter-spacing: 0.01em;
}
.meta dd .sep { color: #c7cbd0; padding: 0 8px; }
.meta dd .muted { color: #a8adb5; }

/* ─── Terminal block ─── */
.terminal {
  margin-top: 32px;
  width: 100%;
  max-width: 560px;
  border: 1px solid #e6e8eb;
  border-radius: 10px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  text-align: left;
  box-shadow: 0 1px 0 rgba(29,29,31,0.02), 0 12px 40px -16px rgba(29,29,31,0.12);
  opacity: 0; transform: translateY(20px);
  animation: rise 1s cubic-bezier(0.16,1,0.3,1) 1.5s forwards;
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid #eef0f3;
}
.terminal-bar .tdot {
  width: 8px; height: 8px; border-radius: 50%; background: #e6e8eb;
}
.terminal-bar .tlabel {
  margin-left: auto;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #a8adb5;
}
.terminal pre {
  margin: 0;
  padding: 16px 18px 18px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.7;
  color: #1d1d1f;
  white-space: pre;
  overflow-x: auto;
}
.terminal pre .prompt { color: #a8adb5; user-select: none; }
.terminal pre .key    { color: #1d1d1f; font-weight: 500; }
.terminal pre .val    { color: #4a4a4f; }
.terminal pre .cmd    { color: #1d1d1f; font-weight: 500; }
.terminal pre .placeholder { color: #a8adb5; font-style: italic; }
/* Comments — visually quieter so the commands read first; sits as a
   section-header layer above each phase of the quickstart. */
.terminal pre .cmt    { color: #a8adb5; }
/* Curl response indicator — slightly punchier than a comment so the
   key the user receives feels like an output, not commentary. */
.terminal pre .ret    { color: #5e6068; }
.terminal pre .cursor {
  display: inline-block;
  width: 7px; height: 14px;
  background: #1d1d1f;
  vertical-align: -2px;
  margin-left: 2px;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ─── CTAs ─── */
.ctas {
  margin-top: 44px;
  display: flex;
  gap: 26px;
  align-items: center;
  opacity: 0; transform: translateY(16px);
  animation: rise 1s cubic-bezier(0.16,1,0.3,1) 1.2s forwards;
}
.cta {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #1d1d1f;
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, transform 0.3s ease;
}
.cta:hover { border-bottom-color: #1d1d1f; }
.cta .arrow {
  display: inline-block;
  margin-left: 6px;
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
}
.cta:hover .arrow { transform: translateX(3px); }

/* Primary CTA — the one action we want everyone to take. Promoted from a
   text link into a solid filled pill so it carries real visual weight against
   the otherwise monochrome, understated hero. */
.cta.primary {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  background: #1d1d1f;
  padding: 13px 24px;
  border-bottom: none;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12), 0 8px 24px rgba(0,0,0,0.14);
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1), box-shadow 0.3s ease, background 0.3s ease;
}
.cta.primary:hover {
  background: #000000;
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.16), 0 14px 34px rgba(0,0,0,0.2);
}

.cta.secondary { color: #86868b; }
.cta.secondary:hover { color: #1d1d1f; border-bottom-color: #86868b; }

/* Helper line under the CTAs, sitting just above the terminal block. Tells
   non-CLI users that the primary CTA does double duty (mint a key AND top up)
   so they don't assume they need to run the terminal commands below first. */
.ctas-hint {
  margin-top: 14px;
  max-width: 420px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: #a8adb5;
  text-align: center;
  opacity: 0; transform: translateY(12px);
  animation: rise 1s cubic-bezier(0.16,1,0.3,1) 1.35s forwards;
}

/* ─── Explainer + use cases ───
   Lives below the terminal block in the hero's internal scroll, so the
   above-fold hero stays punchy and this rewards a scroll. Continues the
   staggered rise cadence (terminal lands at 1.5s, this picks up at 1.65s). */
.explain {
  margin-top: 72px;
  padding-top: 56px;
  width: 100%;
  max-width: 760px;
  border-top: 1px solid #eef0f3;
  text-align: left;
}
.explain-title {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: #1d1d1f;
  text-align: center;
  opacity: 0; transform: translateY(16px);
  animation: rise 1s cubic-bezier(0.16,1,0.3,1) 1.65s forwards;
}
.explain-lede {
  margin: 18px auto 0;
  max-width: 620px;
  text-align: center;
  font-size: 15px;
  font-weight: 300;
  line-height: 1.65;
  color: #4a4a4f;
  opacity: 0; transform: translateY(16px);
  animation: rise 1s cubic-bezier(0.16,1,0.3,1) 1.78s forwards;
}

.cases {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: #eef0f3;
  border: 1px solid #eef0f3;
  border-radius: 10px;
  overflow: hidden;
  opacity: 0; transform: translateY(20px);
  animation: rise 1s cubic-bezier(0.16,1,0.3,1) 1.9s forwards;
}
.case {
  background: #ffffff;
  padding: 22px 22px 24px;
  transition: background 0.3s ease;
}
.case:hover { background: #fafbfc; }
.case-num {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: #c7cbd0;
}
.case h3 {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #1d1d1f;
}
.case p {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 300;
  line-height: 1.6;
  color: #6a6c72;
}

/* ─── Global usage stats ───
   Closing band below the use cases. Starts hidden+offset; scripts.js reveals it
   (toggles [hidden] off, adds .is-visible) once /v1/stats clears the threshold,
   then count-up animates the figures. Because the reveal is data-driven rather
   than time-driven, it uses a transition fired on `.is-visible` instead of the
   load-time `rise` keyframe the rest of the hero uses. */
.stats {
  margin-top: 72px;
  padding-top: 40px;
  width: 100%;
  max-width: 760px;
  border-top: 1px solid #eef0f3;
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.9s cubic-bezier(0.16,1,0.3,1),
    transform 0.9s cubic-bezier(0.16,1,0.3,1);
}
.stats.is-visible { opacity: 1; transform: translateY(0); }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: #eef0f3;
  border: 1px solid #eef0f3;
  border-radius: 10px;
  overflow: hidden;
}
.stat {
  background: #ffffff;
  padding: 26px 18px;
  text-align: center;
}
.stat-num {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: #1d1d1f;
  /* Tabular figures keep the glyph box stable so the count-up doesn't jitter. */
  font-variant-numeric: tabular-nums;
}
.stat-label {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #a8adb5;
}

/* ─── Foot tag (bottom of flex column) ─── */
.foot {
  /* In flex flow (not absolute) so it always sits below the hero's scroll
     region, never overlapping CTAs when the hero scrolls to its end. */
  flex: 0 0 auto;
  position: relative;
  z-index: 10;
  padding: 22px 40px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #a8adb5;
  user-select: none;
}
.foot .sep { color: #d8dbe0; padding: 0 8px; }
.foot a {
  color: #a8adb5;
  text-decoration: none;
  transition: color 0.3s ease;
}
.foot a:hover { color: #1d1d1f; }

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive ───
   Three independent axes are tuned:
     - max-width 760px  → phone / narrow tablet (typography, single-col meta)
     - max-width 420px  → very narrow phones (foldables, 320-360px screens)
     - max-height 640px → short viewports (landscape phones, split windows) */
@media (max-width: 760px) {
  .page::before { height: 72px; }
  .brand, .status { padding: 20px 22px; }
  .brand-name { font-size: 16px; }
  .status { font-size: 10px; gap: 7px; }
  .hero { padding: 80px 22px 36px; }
  .hero-title { font-size: clamp(30px, 8vw, 44px); letter-spacing: -0.03em; }
  .hero-sub { font-size: 14px; }
  .meta {
    grid-template-columns: 1fr;
    gap: 4px;
    margin-top: 30px;
    max-width: 320px;
  }
  .meta dt::after { display: none; }
  .terminal pre { font-size: 12px; padding: 14px 14px 16px; }
  .ctas { flex-direction: column; gap: 14px; margin-top: 24px; }
  .explain { margin-top: 56px; padding-top: 44px; }
  .cases { grid-template-columns: 1fr; margin-top: 32px; }
  .stats { margin-top: 56px; padding-top: 36px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat { padding: 22px 14px; }
  .foot { padding: 16px 22px; font-size: 9px; }
}

@media (max-width: 420px) {
  /* Tight horizontal real estate — pull the chrome in further and let the
     hero use slightly more of the available width. */
  .page::before { height: 60px; }
  .brand, .status { padding: 16px 16px; }
  .hero { padding: 72px 16px 28px; }
  .hero-title { font-size: clamp(26px, 9vw, 36px); }
  .hero-sub { font-size: 13px; }
  .hero-noscript { font-size: 12px; }
  .eyebrow { letter-spacing: 0.2em; font-size: 10px; margin-bottom: 22px; }
  .terminal pre { font-size: 11px; line-height: 1.65; }
  .foot { padding: 14px 16px; letter-spacing: 0.18em; }
}

@media (max-height: 640px) {
  /* Short viewport (e.g. landscape phone). The brand/status/foot chrome is
     already small; pull hero padding tight so more content sits in the
     scrollable middle without the hero immediately overflowing. */
  .page::before { height: 56px; }
  .hero { padding: 60px 24px 28px; }
  .eyebrow { margin-bottom: 18px; }
  .hero-sub { margin-top: 20px; }
  .hero-noscript { margin-top: 10px; }
  .meta { margin-top: 24px; }
  .terminal { margin-top: 22px; }
  .ctas { margin-top: 22px; }
  .explain { margin-top: 56px; padding-top: 44px; }
  .foot { padding: 14px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .status-dot::after { display: none; }
  .terminal pre .cursor { animation: none; opacity: 1; }
}
