/* Header */

/* Logo: the script wordmark, cropped tight, so the height sets its size */
.md-header__button.md-logo img {
  height: 1.45rem;
  width: auto;
  transition: opacity 0.2s ease;
}

.md-header__button.md-logo:hover img {
  opacity: 0.8;
}

/* Site title - the wordmark logo carries the brand, so hide the static
   site name; the current page title still slides in on scroll */
.md-header__topic:first-child {
  display: none;
}

.md-header__title {
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* GitHub icon in header */
.md-header__source {
  width: auto;
}

/* Footer */
.md-social {
  gap: 0.6rem;
}

.md-social__link {
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
}

.md-social__link:hover {
  opacity: 1;
  transform: scale(1.1);
}

.md-copyright {
  font-size: 0.7rem;
  opacity: 0.7;
}

/* ============ Homepage hero action buttons ============ */
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin: 1.7rem auto 0.4rem;
}
/* md_in_html wraps the button links in a <p>; dissolve it so the
   buttons are direct flex items and the gap/justify actually apply */
.hero-actions > p {
  display: contents;
}
/* equal-width buttons that fill the row (used on the Semantic hero) */
.hero-actions--fill .md-button {
  flex: 1 1 0;
  justify-content: center;
}
.hero-actions .md-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.5rem 1.1rem;
  border-radius: 0.4rem;
  border: 1px solid var(--md-default-fg-color--lighter, #3a4763);
  background: transparent;
  color: var(--md-default-fg-color--light);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.015em;
  line-height: 1;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.hero-actions .md-button svg {
  width: 1.02em;
  height: 1.02em;
  fill: currentColor;
}
.hero-actions .md-button:hover {
  color: var(--md-default-fg-color);
  border-color: var(--md-default-fg-color--light);
  background: color-mix(in srgb, var(--md-default-fg-color) 6%, transparent);
}

/* PGSync Semantic flow diagram (hero on the Semantic page) */
.pgpro-flow {
  margin: 2rem auto 0.4rem;
  max-width: 34rem;
}
.pgpro-flow svg {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 22px;
  box-shadow: var(--md-shadow-z3);
}

/* Two-column hero on the Semantic page: pitch left, diagram right */
.pgpro-hero {
  display: grid;
  grid-template-columns: 1fr 1.08fr;
  gap: 2.4rem;
  align-items: center;
  margin: 0.6rem 0 0.4rem;
}
.pgpro-hero__text h1 {
  margin-top: 0.2rem;
}
/* hero buttons: left-aligned beside the diagram on desktop */
.pgpro-hero__text .hero-actions {
  justify-content: flex-start;
  margin: 1.5rem 0 0.4rem;
}
.pgpro-hero .pgpro-flow {
  margin: 0;
  max-width: none;
}
@media screen and (max-width: 60em) {
  .pgpro-hero { grid-template-columns: 1fr; gap: 1rem; }
  .pgpro-hero__text { text-align: center; }
  .pgpro-hero__text .hero-actions { justify-content: center; }
}

/* ============ PGSync ClickHouse hero + flow (mirrors the Semantic hero) ============ */
.pgch-hero {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 2.4rem;
  align-items: center;
  margin: 0.6rem 0 0.4rem;
}
.pgch-hero__text h1 { margin-top: 0.2rem; }
.pgch-hero__text .hero-actions {
  justify-content: flex-start;
  margin: 1.5rem 0 0.4rem;
}
.pgch-flow { margin: 0; max-width: none; }
.pgch-flow svg {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 22px;
  box-shadow: var(--md-shadow-z3);
}
@media screen and (max-width: 60em) {
  .pgch-hero { grid-template-columns: 1fr; gap: 1rem; }
  .pgch-hero__text { text-align: center; }
  .pgch-hero__text .hero-actions { justify-content: center; }
}

/* ============ How-it-works animated pipeline ============ */
.pl {
  max-width: 52rem;
  margin: 2rem auto 0.5rem;
  background: var(--gr-surface);
  border: 1px solid var(--gr-border);
  border-radius: 18px;
  padding: 1.6rem 1.8rem 2rem;
  box-shadow: var(--md-shadow-z3);
}
.pl-steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.4rem;
}
.pl-step {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--md-code-font-family), monospace;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--md-default-fg-color--light);
  background: transparent;
  border: 1px solid var(--gr-border);
  border-radius: 2rem;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.pl-step .pl-num {
  display: inline-grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: var(--gr-border);
  color: var(--md-default-fg-color--light);
  font-size: 0.66rem;
}
.pl-step:hover { color: var(--md-default-fg-color); }
/* active-pill colours live in the flow-rail block below (per-step --pl-accent) */

/* Stage stacks every panel into one grid cell, so it grows to the TALLEST
   panel (Search/Embed run past a fixed height and used to spill the border). */
.pl-stage { display: grid; min-height: 320px; }
.pl-panel {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity 0.5s, transform 0.5s, visibility 0s 0.5s;
  pointer-events: none;
}
.pl-panel.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
  transition: opacity 0.5s, transform 0.5s, visibility 0s 0s;
}
.pl-cap {
  text-align: center;
  color: var(--md-default-fg-color--light);
  font-size: 0.95rem;
  margin: 0 auto 1.2rem;
  max-width: 40rem;
}

/* tables */
.pl-tables { display: flex; gap: 1.2rem; justify-content: center; flex-wrap: wrap; }
.pl-table {
  border: 1px solid var(--gr-border);
  border-radius: 10px;
  overflow: hidden;
  min-width: 15rem;
  font-family: var(--md-code-font-family), monospace;
  font-size: 0.76rem;
}
.pl-th {
  background: var(--gr-surface-2);
  color: var(--gr-accent);
  padding: 0.4rem 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.pl-tr { display: flex; justify-content: space-between; gap: 1rem; padding: 0.34rem 0.8rem; border-top: 1px solid var(--gr-border); }
.pl-tr span:first-child { color: var(--gr-subtle); }
.pl-tr span:last-child { color: var(--gr-text); }

/* code (sql + json) */
.pl-code {
  background: var(--gr-bg);
  border: 1px solid var(--gr-border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  font-family: var(--md-code-font-family), monospace;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--gr-text);
  max-width: 40rem;
  margin: 0 auto;
  overflow-x: auto;
}
.pl-code .k { color: var(--md-code-hl-keyword-color); }
.pl-code .s { color: var(--md-code-hl-string-color); }
.pl-code .key { color: var(--md-code-hl-name-color); }
.pl-code .p { color: var(--gr-subtle); }

/* embed */
.pl-embed-src, .pl-query {
  text-align: center;
  font-family: var(--md-code-font-family), monospace;
  font-size: 0.82rem;
  color: var(--gr-text);
  border: 1px solid var(--gr-border);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  max-width: 34rem;
  margin: 0 auto;
}
.pl-query { font-family: var(--md-text-font-family); font-size: 1.1rem; font-style: italic; color: var(--gr-text-strong); }
.pl-flow-down { text-align: center; margin: 0.9rem 0; color: var(--gr-subtle); font-family: var(--md-code-font-family), monospace; font-size: 0.7rem; }
.pl-flow-down span {
  display: block; width: 2px; height: 26px; margin: 0 auto 6px;
  background: linear-gradient(var(--gr-border-strong), var(--pl-accent)); border-radius: 2px;
  position: relative; overflow: hidden;
}
.pl-flow-down span::after {
  content: ""; position: absolute; left: -1px; width: 4px; height: 8px;
  background: var(--gr-text-strong); border-radius: 2px; animation: pl-drop 1.3s linear infinite;
}
@keyframes pl-drop { from { top: -8px; } to { top: 28px; } }
.pl-vec {
  text-align: center;
  font-family: var(--md-code-font-family), monospace;
  font-size: 0.82rem;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  max-width: 40rem;
  margin: 0 auto;
}
.pl-vec .pl-dim { color: var(--gr-subtle); margin-left: 0.6rem; font-size: 0.72rem; }
.pl-note { text-align: center; color: var(--md-default-fg-color--light); font-size: 0.82rem; max-width: 38rem; margin: 1.1rem auto 0; }
.pl-note b { color: var(--md-default-fg-color); }

/* result */
.pl-result {
  border: 1px solid transparent;
  background: var(--gr-surface-2);
  border-radius: 12px;
  padding: 1rem 1.3rem;
  max-width: 34rem;
  margin: 0 auto;
}
.pl-result-title { font-family: var(--md-text-font-family); font-size: 1.25rem; font-weight: 600; color: var(--gr-text-strong); }
.pl-result-meta { font-family: var(--md-code-font-family), monospace; font-size: 0.76rem; color: var(--gr-subtle); margin: 0.3rem 0 0.7rem; }
.pl-result-meta b { color: var(--gr-text); }
.pl-pill {
  display: inline-block;
  font-family: var(--md-code-font-family), monospace;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: 2rem;
  padding: 0.25rem 0.7rem;
}

/* ---- pipeline flow rail: per-step colour, travelling packet, progress ---- */
.pl { --pl-accent: #8fa3bf; }
.pl-steps { position: relative; z-index: 1; }
.pl-line {
  position: absolute; top: 50%; left: 6%; right: 6%; height: 2px;
  background: var(--gr-border-strong); transform: translateY(-50%); z-index: 0;
}
.pl-packet {
  position: absolute; top: 50%; left: 0; width: 11px; height: 11px;
  margin-left: -5.5px; transform: translateY(-50%); border-radius: 50%;
  background: var(--pl-accent);
  box-shadow: 0 0 8px 1px var(--pl-accent);
  opacity: 0;
  transition: left 0.55s cubic-bezier(0.4, 0, 0.2, 1), background 0.4s, opacity 0.3s;
  z-index: 3;
}
/* comet tail trailing the packet as it advances left-to-right */
.pl-packet::before {
  content: ""; position: absolute; right: 50%; top: 50%;
  width: 2.4rem; height: 3px; transform: translateY(-50%);
  background: linear-gradient(270deg, var(--pl-accent), transparent);
  border-radius: 3px; opacity: 0.55; pointer-events: none;
}
.pl-step { position: relative; z-index: 1; background: var(--gr-surface); }
.pl-step.is-active {
  color: #16181c;
  background: var(--pl-accent);
  border-color: var(--pl-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--pl-accent) 18%, transparent);
}
.pl-step.is-active .pl-num { background: #16181c; color: var(--pl-accent); }

.pl-progress {
  height: 3px; margin: 1rem 6% 0.2rem;
  background: var(--gr-border-strong); border-radius: 3px; overflow: hidden;
}
.pl-fill {
  display: block; width: 0; height: 100%;
  background: var(--pl-accent); border-radius: 3px;
  animation: pl-progress var(--pl-dur, 4.6s) linear;
}
@keyframes pl-progress { from { width: 0; } to { width: 100%; } }
.pl:hover .pl-fill { animation-play-state: paused; }

/* tie the panel accents to the active step colour */
.pl-vec {
  color: var(--pl-accent);
  background: color-mix(in srgb, var(--pl-accent) 8%, transparent);
  border-color: color-mix(in srgb, var(--pl-accent) 35%, transparent);
}
.pl-result { border-color: color-mix(in srgb, var(--pl-accent) 40%, transparent); }
.pl-pill {
  color: var(--pl-accent);
  background: color-mix(in srgb, var(--pl-accent) 14%, transparent);
}

/* Grid cards: lay each card out as a column and push a last paragraph that
   holds a link (the card's button) to the bottom, so CTAs line up across
   cards of differing height, e.g. the Pricing page's "Get it on GitHub" vs
   "Get PGSync Semantic". Text-only cards keep their normal spacing. */
.md-typeset .grid.cards > :is(ul, ol) > li {
  display: flex;
  flex-direction: column;
}
.md-typeset .grid.cards > :is(ul, ol) > li > p:last-child:has(a) {
  margin-top: auto;
  padding-top: 0.6rem;
}
