/* The landing (/), loaded only by layouts/home. Ported from the design export
   (pgrun-export 3/style.css); nearly all styling is inline in pages/home.html.erb, so this
   holds only what inline styles cannot: keyframes, hover states and scrollbars. The IBM Plex
   Mono @import moved to <link> tags in the layout. */

* { box-sizing: border-box; }
body { margin: 0; background: #0b0d0f; color: oklch(0.92 0.005 250); font-family: 'IBM Plex Mono', monospace; font-size: 14.5px; line-height: 1.6; }
::selection { background: oklch(0.55 0.10 235); color: #fff; }
a { color: oklch(0.78 0.10 235); text-decoration: none; }
a:hover { color: oklch(0.66 0.01 250); }

/* Not in the export: the top-right corner of the page. ::before is the dot grid from the
   sign-in page (auth.css), mirrored into this corner; ::after is a soft white light after
   resend.com — a haze plus a few blurred rays falling down-left across the hero. Both sit
   behind all content (isolation + negative z-index), and the site menu drops its background
   here so they run under it. overflow-x:clip keeps the oversized light layer from widening
   the page. */
.home-root { position: relative; isolation: isolate; overflow-x: clip; }
.home-root header.site-menu { background: transparent; }
.home-root::before {
  content: ""; position: absolute; top: 0; right: 0; z-index: -2; pointer-events: none;
  width: min(760px, 100%); height: 680px;
  background: radial-gradient(rgba(255, 255, 255, 0.10) 1px, transparent 1.4px) 0 0/11px 11px;
  -webkit-mask-image: radial-gradient(100% 100% at 100% 0, #000 16%, transparent 70%);
          mask-image: radial-gradient(100% 100% at 100% 0, #000 16%, transparent 70%);
}
/* Hover effect on that grid: the dots near the pointer turn black — nothing else changes.
   Same box and grid as ::before, so each black dot lands on (and covers) a white one. The
   mask is the pointer circle intersected with ::before's corner vignette, so only dots that
   are actually showing change colour. z-index -1 puts it above ::before and the ::after
   light (both -2), which would otherwise wash the black out. home.js sets --mx/--my to the
   pointer's position in this box and toggles .is-on while the pointer is inside it. */
.home-dots-lens {
  --mx: 50%; --my: 50%;
  position: absolute; top: 0; right: 0; z-index: -1; pointer-events: none;
  width: min(760px, 100%); height: 680px;
  background: radial-gradient(#000 1.3px, transparent 1.7px) 0 0/11px 11px;
  -webkit-mask-image:
    radial-gradient(circle 150px at var(--mx) var(--my), #000 45%, transparent 100%),
    radial-gradient(100% 100% at 100% 0, #000 16%, transparent 70%);
  -webkit-mask-composite: source-in;
  mask-image:
    radial-gradient(circle 150px at var(--mx) var(--my), #000 45%, transparent 100%),
    radial-gradient(100% 100% at 100% 0, #000 16%, transparent 70%);
  mask-composite: intersect;
  opacity: 0; transition: opacity 0.35s ease;
}
.home-dots-lens.is-on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .home-dots-lens { transition: none; } }

/* The rays fan out from the corner: a conic gradient centred there, where 180deg points
   straight down and 270deg straight left, so the bands fall down-left and flatten toward the
   left. Oversized past the top and right edges so the blur does not fade the source. */
.home-root::after {
  content: ""; position: absolute; top: -80px; right: -80px; z-index: -2; pointer-events: none;
  width: min(1520px, calc(100% + 80px)); height: 1080px;
  background:
    radial-gradient(52% 62% at 100% 0%, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0.06) 38%, transparent 72%),
    conic-gradient(from 180deg at 100% 0%,
      transparent 0deg,
      rgba(255, 255, 255, 0.05) 22deg, transparent 34deg,
      rgba(255, 255, 255, 0.09) 50deg, transparent 60deg,
      rgba(255, 255, 255, 0.05) 67deg, transparent 77deg,
      transparent 90deg);
  filter: blur(16px);
  -webkit-mask-image: radial-gradient(100% 100% at 100% 0%, #000 0%, rgba(0, 0, 0, 0.55) 40%, transparent 85%);
          mask-image: radial-gradient(100% 100% at 100% 0%, #000 0%, rgba(0, 0, 0, 0.55) 40%, transparent 85%);
}

/* ---------- the demo terminal (#demo) ---------- */
/* A window: hairline border with a lit top edge, a faint blue glow under it, and
   overflow:hidden so every child is clipped to the rounded corners (the panes' square
   backgrounds used to cut the border at the bottom). */
.term {
  --term-line: rgba(255, 255, 255, 0.07);
  width: 100%; max-width: 880px; overflow: hidden;
  background: #0b0d0f;
  border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 14px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 40px 100px -30px rgba(0, 0, 0, 0.9),
    0 0 90px -30px oklch(0.72 0.11 235 / 0.22);
}

.term-bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--term-line);
  background: linear-gradient(180deg, #16191e 0%, #101216 100%);
}
.term-lights { display: flex; gap: 8px; }
.term-lights span { width: 11px; height: 11px; border-radius: 50%; box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.35); }
.term-lights span:nth-child(1) { background: #ff5f57; }
.term-lights span:nth-child(2) { background: #febc2e; }
.term-lights span:nth-child(3) { background: #28c840; }
.term-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: oklch(0.85 0.01 250); }
.term-title-dim { font-weight: 400; color: oklch(0.52 0.01 250); }
.term-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.term-key {
  display: flex; align-items: center; justify-content: center; width: 24px; height: 22px;
  border: 1px solid oklch(0.3 0.008 250); border-radius: 6px; background: rgba(255, 255, 255, 0.02);
  color: oklch(0.6 0.01 250); font-size: 11px; cursor: pointer; transition: color 0.15s, border-color 0.15s;
}
.term-key:hover { color: oklch(0.92 0.005 250); border-color: oklch(0.45 0.01 250); }
.term-key-info { width: 22px; border-radius: 50%; font-style: italic; font-weight: 700; cursor: default; }
.info-wrap { position: relative; }
.info-tooltip {
  position: absolute; top: 30px; right: 0; z-index: 10; width: 240px;
  padding: 12px 14px; border: 1px solid oklch(0.28 0.008 250); border-radius: 8px; background: #12141a;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.7);
  font-size: 12px; line-height: 1.6; color: oklch(0.66 0.01 250);
}

.term-panes { display: flex; }

/* Left: the branch tree, on a slightly lifted sidebar tint. */
.term-tree {
  width: 42%; max-height: 340px; overflow-y: auto; padding: 14px 10px;
  border-right: 1px solid var(--term-line); background: #0d0f12;
  font-size: 13px; line-height: 2;
}
.term-tree-head {
  display: flex; align-items: center; gap: 8px; padding: 0 8px 8px; margin-bottom: 6px;
  border-bottom: 1px dashed var(--term-line); color: oklch(0.88 0.01 250); font-weight: 700;
}
/* "live" wears the blue of the site's "sign up" button, like the branch times below it. */
.term-badge {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 0 8px;
  border: 1px solid oklch(0.72 0.11 235 / 0.4); border-radius: 999px; background: oklch(0.72 0.11 235 / 0.1);
  font-size: 11px; line-height: 20px; font-weight: 600; color: oklch(0.78 0.1 235);
}
.term-badge i { width: 6px; height: 6px; border-radius: 50%; background: oklch(0.72 0.11 235); box-shadow: 0 0 6px oklch(0.72 0.11 235); animation: pulse 2s ease-in-out infinite; }

.branch-row { display: flex; gap: 7px; align-items: center; padding: 0 8px; border-radius: 6px; animation: fadeIn 0.35s ease-out; transition: background 0.15s; }
.branch-row:hover { background: rgba(255, 255, 255, 0.035); }
.branch-row.removing { animation: fadeOut 0.3s ease-out forwards; }
.br-connector { color: oklch(0.36 0.008 250); white-space: pre; }
.br-icon { flex-shrink: 0; }
.br-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: oklch(0.8 0.03 235); }
.br-status { min-width: 84px; font-size: 12px; font-variant-numeric: tabular-nums; }

/* Right: the shell. */
.term-history { width: 58%; height: 340px; overflow-y: scroll; padding: 16px 18px; font-size: 13px; line-height: 1.8; }
.hb-block { margin-bottom: 16px; }
.hb-head { display: flex; align-items: center; gap: 8px; line-height: 1.5; }
.hb-path { flex-shrink: 0; color: oklch(0.72 0.11 235); }
.hb-dollar { flex-shrink: 0; color: oklch(0.52 0.01 250); }
/* pre-wrap keeps the typed spaces but lets a long command wrap on a narrow pane. */
.hb-cmd { min-width: 0; white-space: pre-wrap; overflow-wrap: break-word; color: oklch(0.92 0.005 250); }
.hb-cursor {
  display: inline-block; width: 7px; height: 15px; margin-left: -6px; flex-shrink: 0;
  background: oklch(0.72 0.11 235); box-shadow: 0 0 8px oklch(0.72 0.11 235 / 0.8);
  animation: blink 1s step-end infinite;
}
.hb-outputs { padding-left: 16px; border-left: 1px solid var(--term-line); margin: 6px 0 0 3px; }
.hb-line { margin-top: 4px; animation: fadeIn 0.25s ease-out; }

/* Bottom: a tmux-like status bar; #termCount is kept current by home.js. */
.term-status {
  display: flex; align-items: stretch; border-top: 1px solid var(--term-line); background: #0d0f12;
  font-size: 11.5px; line-height: 28px; color: oklch(0.62 0.01 250);
}
.term-status-seg { display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; border-right: 1px solid var(--term-line); white-space: nowrap; }
.term-status-mode { background: oklch(0.72 0.11 235); color: #0b0d0f; font-weight: 700; border-right: 0; }
.term-status-dot { width: 6px; height: 6px; border-radius: 50%; background: oklch(0.75 0.11 160); }
.term-status-dim { color: oklch(0.5 0.01 250); }
.term-status-right { margin-left: auto; border-right: 0; border-left: 1px solid var(--term-line); font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .term-badge i, .hb-cursor { animation: none; }
  .term-key, .branch-row { transition: none; }
}

/* "Why pgrun" cards lift their border a step on hover. !important: the border is inline. */
.home-why-card { transition: border-color 0.15s ease; }
.home-why-card:hover { border-color: oklch(0.36 0.008 250) !important; }
@media (prefers-reduced-motion: reduce) { .home-why-card { transition: none; } }

#historyPane { scrollbar-width: none; }
#historyPane::-webkit-scrollbar { display: none; }
.branches-pane { scrollbar-width: none; }
.branches-pane::-webkit-scrollbar { display: none; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@keyframes vizNode0 { 0%, 88% { background: #333; } 92%, 100% { background: #fff; } }
@keyframes vizNode1 { 0%, 5% { background: #333; } 9%, 88% { background: #fff; } 92%, 100% { background: #333; } }
@keyframes vizNode2 { 0%, 15% { background: #333; } 19%, 88% { background: #fff; } 92%, 100% { background: #333; } }
@keyframes vizNode3 { 0%, 25% { background: #333; } 29%, 88% { background: #fff; } 92%, 100% { background: #333; } }
@keyframes vizNode4 { 0%, 35% { background: #333; } 39%, 88% { background: #fff; } 92%, 100% { background: #333; } }
@keyframes vizNode5 { 0%, 45% { background: #333; } 49%, 88% { background: #fff; } 92%, 100% { background: #333; } }
@keyframes vizNode6 { 0%, 55% { background: #333; } 59%, 88% { background: #fff; } 92%, 100% { background: #333; } }
@keyframes vizArrow0 { 0%, 4% { stroke-dashoffset: 48; opacity: 1; } 9%, 88% { stroke-dashoffset: 0; opacity: 1; } 92%, 100% { stroke-dashoffset: 48; opacity: 0; } }
@keyframes vizArrow1 { 0%, 9% { stroke-dashoffset: 48; opacity: 0; } 10%, 14% { opacity: 1; } 19%, 88% { stroke-dashoffset: 0; opacity: 1; } 92%, 100% { stroke-dashoffset: 48; opacity: 0; } }
@keyframes vizArrow2 { 0%, 19% { stroke-dashoffset: 48; opacity: 0; } 20%, 24% { opacity: 1; } 29%, 88% { stroke-dashoffset: 0; opacity: 1; } 92%, 100% { stroke-dashoffset: 48; opacity: 0; } }
@keyframes vizArrow3 { 0%, 29% { stroke-dashoffset: 48; opacity: 0; } 30%, 34% { opacity: 1; } 39%, 88% { stroke-dashoffset: 0; opacity: 1; } 92%, 100% { stroke-dashoffset: 48; opacity: 0; } }
@keyframes vizArrow4 { 0%, 39% { stroke-dashoffset: 48; opacity: 0; } 40%, 44% { opacity: 1; } 49%, 88% { stroke-dashoffset: 0; opacity: 1; } 92%, 100% { stroke-dashoffset: 48; opacity: 0; } }
@keyframes vizArrow5 { 0%, 49% { stroke-dashoffset: 48; opacity: 0; } 50%, 54% { opacity: 1; } 59%, 88% { stroke-dashoffset: 0; opacity: 1; } 92%, 100% { stroke-dashoffset: 48; opacity: 0; } }
@keyframes vizLabel0 { 0%, 88% { opacity: 1; } 92%, 100% { opacity: 0; } }
@keyframes vizLabel1 { 0%, 6% { opacity: 0; } 10%, 88% { opacity: 1; } 92%, 100% { opacity: 0; } }
@keyframes vizLabel2 { 0%, 16% { opacity: 0; } 20%, 88% { opacity: 1; } 92%, 100% { opacity: 0; } }
@keyframes vizLabel3 { 0%, 26% { opacity: 0; } 30%, 88% { opacity: 1; } 92%, 100% { opacity: 0; } }
@keyframes vizLabel4 { 0%, 36% { opacity: 0; } 40%, 88% { opacity: 1; } 92%, 100% { opacity: 0; } }
@keyframes vizLabel5 { 0%, 46% { opacity: 0; } 50%, 88% { opacity: 1; } 92%, 100% { opacity: 0; } }
@keyframes vizLabel6 { 0%, 56% { opacity: 0; } 60%, 88% { opacity: 1; } 92%, 100% { opacity: 0; } }

/* The menu's own rules (products dropdown, flashing dot, phone wrap) live in chrome.css with
   the shared/_site_nav partial, which every public page renders. */
.info-tooltip { display: none; }
.info-wrap:hover .info-tooltip { display: block; animation: fadeIn 0.15s ease-out; }

/* Not in the export, which only laid out for desktop: phones scrolled sideways (the
   five-column steps grid and the footer links overflowed) and the two demo panes were
   squeezed to half of ~310px. Phone-only, so desktop renders exactly as designed.
   !important because the rules it overrides are inline. */
@media (max-width: 720px) {
  .term-panes { flex-direction: column; }
  .term-tree { width: 100%; max-height: 220px; border-right: 0; border-bottom: 1px solid var(--term-line); }
  .term-history { width: 100%; height: 280px; }
  .term-title-dim, .term-status-dim, .term-status-conn { display: none; }
  .home-steps { grid-template-columns: repeat(2, 1fr) !important; row-gap: 48px; }
  .home-foot-links { flex-wrap: wrap; row-gap: 8px; }
}

/* ---------- phones ----------
   The page is the design export, so its spacing and type sizes live in inline styles and
   need !important to move. Everything here is width only: nothing changes above 560px. */
@media (max-width: 560px) {
  /* One gutter for every band, instead of the export's 40px. */
  .home-root > header,
  .home-root > section,
  .home-root > footer { padding-left: 20px !important; padding-right: 20px !important; }
  .home-root > header { padding-top: 36px !important; }

  /* 42px set three lines of "Every agent gets its own Postgres." on a 390px screen and
     pushed everything else below the fold. */
  .home-root h1 { font-size: clamp(27px, 8.4vw, 40px) !important; line-height: 1.12 !important; }
  .home-root h2 { font-size: clamp(21px, 6vw, 30px) !important; line-height: 1.2 !important; }

  /* The install command broke mid-URL with the copy label stranded beside it. Stack it:
     prompt + command on one line that may wrap at the slashes, copy underneath. */
  /* Flex wrapping put the `$` on a line of its own, because a flex item wraps whole rather
     than breaking mid-token. Plain inline text wraps the way a command should: the prompt
     stays with the command, and the URL breaks only where it runs out of room. */
  #copyInstall {
    display: block !important;
    text-align: center;
    padding: 12px 14px !important;
    font-size: 12.5px !important;
    max-width: 100%;
  }
  #copyInstall > span { display: inline; }
  #copyInstall > span:nth-child(2) { word-break: break-word; }
  #copyLabel { display: block !important; margin-top: 8px; }
}

/* ---- pgbot mascot (hero), ported from pgbot.dev ------------------------
   A 76px white disc that sits above the headline: two eyes lean toward the
   pointer, 0/1 digits drift and scatter under it, a soft glow follows it
   inside the face. Everything is inside the disc, so it reads the same on
   this dark hero as it does on pgbot.dev's light one. Sizes/timings are the
   original's; the eye colour is the landing's ink rather than pure black.
   home.js only runs the pointer maths — with JS off (or reduced motion) the
   disc still renders, eyes centred. */
.pgb {
  width: 76px; height: 76px; border-radius: 50%; margin: 0 0 26px;
  background: #fff; border: 2px solid #0b0d0f; position: relative; overflow: hidden;
  box-shadow: 0 10px 24px rgba(0,0,0,.45), 0 3px 8px rgba(0,0,0,.3),
              inset -8px -10px 18px rgba(0,0,0,.08), inset 8px 10px 16px rgba(255,255,255,.8);
}
.pgb-shine { position: absolute; width: 32px; height: 19px; left: 12px; top: 10px; border-radius: 50%;
  background: rgba(255,255,255,.78); filter: blur(4px); z-index: 3; pointer-events: none; }
.pgb-digits { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.pgb-digit { position: absolute; color: rgba(11,13,15,.28); font-size: 10px; font-weight: 900; line-height: 1;
  user-select: none; transition: transform .16s ease-out, opacity .16s ease-out, color .16s ease-out;
  will-change: transform, opacity; }
.pgb-glow { position: absolute; width: 29px; height: 29px; border-radius: 50%;
  background: radial-gradient(circle, rgba(11,13,15,.08), rgba(11,13,15,0));
  transform: translate(-50%,-50%); pointer-events: none; z-index: 2; opacity: .8;
  transition: left .08s linear, top .08s linear; }
.pgb-eyes { position: absolute; left: 50%; top: 50%; width: 39px; height: 25px; transform: translate(-50%,-50%);
  transition: transform .06s linear; z-index: 4; }
.pgb-eye { position: absolute; width: 11px; height: 21px; background: #0b0d0f; border-radius: 999px;
  transform-origin: center; transition: transform .08s linear;
  box-shadow: 0 1px 2px rgba(0,0,0,.2), inset 0 -1px 1px rgba(255,255,255,.08); }
.pgb-eye.left { left: 4px; top: 1px; transform: rotate(16deg) scale(1); }
.pgb-eye.right { right: 4px; top: 1px; transform: rotate(16deg) scale(1); }
@media (prefers-reduced-motion: reduce) {
  .pgb-digit, .pgb-glow, .pgb-eyes, .pgb-eye { transition: none; }
}
