/*
 * Astrocoda showcase styles.
 *
 * Deliberately plain: system fonts, one accent, 1px borders, no gradients,
 * no glow, no glass. The page is documentation-dense on purpose — the product
 * is a backend, and pretending otherwise would misrepresent it.
 */

/* ---------------------------------------------------------------- tokens */

:root {
  color-scheme: dark;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono",
    monospace;

  --bg: #0a0a0b;
  --bg-sunken: #131315;
  --bg-code: #161619;
  --fg: #f4f4f5;
  --fg-muted: #a1a1a8;
  --fg-faint: #74747c;
  --line: #26262b;
  --line-strong: #3a3a42;
  --accent: #ff2e88;
  --accent-fg: #0a0a0b;
  --accent-soft: #2a0f1f;
  /* Passing checks wear the accent rather than a third colour, so the page
     stays two-colour. Failure is the only thing that gets its own hue. */
  --ok: #ff5ca8;
  --ok-soft: #2a0f1f;
  --warn: #f0b429;
  --warn-soft: #241c08;

  --radius: 4px;
  --measure: 68ch;
  --page: 1060px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;

    --bg: #ffffff;
    --bg-sunken: #f6f6f7;
    --bg-code: #f8f8f9;
    --fg: #0a0a0b;
    --fg-muted: #55555c;
    --fg-faint: #7b7b83;
    --line: #e4e4e7;
    --line-strong: #c9c9cf;
    --accent: #c2185b;
    --accent-fg: #ffffff;
    --accent-soft: #fce7f1;
    --ok: #a3154a;
    --ok-soft: #fce7f1;
    --warn: #8a5a00;
    --warn-soft: #fdf4e3;
  }
}

/* ----------------------------------------------------------------- reset */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* A single brand hairline. Cheap, and it stops the page reading as unstyled. */
body::before {
  content: "";
  display: block;
  height: 3px;
  background: var(--accent);
}

h1,
h2,
h3 {
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 600;
}

h1 {
  font-size: 2rem;
  margin: 0 0 12px;
}

h2 {
  font-size: 1.375rem;
  margin: 0 0 10px;
}

h3 {
  font-size: 1rem;
  margin: 0 0 6px;
}

p {
  margin: 0 0 14px;
  max-width: var(--measure);
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

code,
kbd,
pre {
  font-family: var(--mono);
  font-size: 0.875em;
}

:not(pre) > code {
  background: var(--bg-code);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.1em 0.35em;
  white-space: nowrap;
}

pre {
  background: var(--bg-code);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 14px;
  line-height: 1.55;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
  white-space: pre;
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* --------------------------------------------------------- scroll reveal */

.reveal {
  opacity: 0;
  transform: translateY(14px);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity 0.5s ease, transform 0.5s ease;
  transition-delay: var(--reveal-delay, 0ms);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ------------------------------------------------------------ flow strip */

.flow {
  margin-bottom: 24px;
}

.flow-track {
  position: relative;
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-sunken);
}

/* The rail the request travels along. */
.flow-track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--line-strong);
}

.flow-node {
  position: relative;
  flex: 1 1 0;
  padding: 16px 14px;
  min-width: 0;
}

.flow-node + .flow-node {
  border-left: 1px solid var(--line);
}

.flow-k {
  display: block;
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-faint);
  margin-bottom: 3px;
}

.flow-v {
  display: block;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--fg-muted);
  overflow-wrap: anywhere;
}

.flow-node.is-accent .flow-k,
.flow-node.is-accent .flow-v {
  color: var(--accent);
}

/* The 202 node breathes, because it is the beat the product is about. */
.flow-node.is-accent .flow-k {
  animation: breathe 2.8s ease-in-out infinite;
}

@keyframes breathe {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

.flow-dot {
  position: absolute;
  top: 50%;
  left: 0;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--accent);
  animation: traverse 4.5s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes traverse {
  0% {
    left: 0;
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  92% {
    opacity: 1;
  }
  100% {
    left: 100%;
    opacity: 0;
  }
}

.flow-caption {
  margin: 10px 0 0;
  font-size: 0.8125rem;
  color: var(--fg-faint);
  max-width: var(--measure);
}

/* ---------------------------------------------------------------- terminal */

.term [data-line] {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.term [data-line].is-shown {
  opacity: 1;
}

.term-prompt {
  color: var(--accent);
}

.term-ok {
  color: var(--accent);
}

.term-cursor {
  display: inline-block;
  width: 7px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1.05s steps(2, start) infinite;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* ------------------------------------------------------------------ hover */

.facts div,
.field,
.price-card,
table tbody tr {
  transition: background-color 0.15s ease;
}

.facts div:hover,
.field:hover {
  background: var(--bg-sunken);
}

table tbody tr:hover {
  background: var(--bg-sunken);
}

.faq summary:hover {
  color: var(--accent);
}

.price-card:hover {
  border-color: var(--accent);
}

.wordmark:hover {
  color: var(--accent);
}

/* ----------------------------------------------------------------- layout */

.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 24px;
}

.narrow {
  max-width: var(--measure);
}

section {
  padding: 56px 0;
  border-top: 1px solid var(--line);
}

section:first-of-type {
  border-top: 0;
}

.section-head {
  margin-bottom: 28px;
}

.section-head p {
  color: var(--fg-muted);
  margin-bottom: 0;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 10px;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
  z-index: 10;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px 12px;
}

/* ---------------------------------------------------------------- header */

.site-header {
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.wordmark {
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
}

.tag {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--accent);
  border: 1px solid var(--accent-soft);
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 2px;
  vertical-align: 1px;
}

.site-nav {
  margin-left: auto;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 0.9375rem;
}

.site-nav a {
  color: var(--fg-muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--fg);
  text-decoration: underline;
}

/* ------------------------------------------------------------------ hero */

.hero {
  padding: 64px 0 56px;
}

.hero p.lede {
  font-size: 1.125rem;
  color: var(--fg-muted);
  margin-bottom: 24px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 28px;
}

.btn {
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.2;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--fg);
  text-decoration: none;
  cursor: pointer;
  display: inline-block;
}

.btn:hover {
  background: var(--bg-sunken);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.btn-primary:hover {
  background: var(--accent);
  filter: brightness(0.94);
}

.btn[disabled],
.btn-primary[disabled] {
  background: var(--bg-sunken);
  border-color: var(--line);
  color: var(--fg-faint);
  cursor: not-allowed;
  filter: none;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.875rem;
}

.facts div {
  padding: 10px 16px;
  border-right: 1px solid var(--line);
  color: var(--fg-muted);
}

.facts div:last-child {
  border-right: 0;
}

.facts strong {
  color: var(--fg);
  font-weight: 600;
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.notice {
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  background: var(--warn-soft);
  color: var(--fg);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 0.875rem;
  margin-bottom: 20px;
  max-width: var(--measure);
}

/* ------------------------------------------------------------------ grid */

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 28px 40px;
}

/* ----------------------------------------------------------------- steps */

ol.steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

ol.steps > li {
  counter-increment: step;
  padding: 16px 18px 16px 52px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

ol.steps > li:last-child {
  border-bottom: 0;
}

ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 18px;
  top: 16px;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: 3px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
}

ol.steps h3 {
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 600;
}

ol.steps p {
  margin: 4px 0 0;
  color: var(--fg-muted);
  font-size: 0.9375rem;
  max-width: none;
}

/* ------------------------------------------------------------------ demo */

.demo {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.demo-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-sunken);
}

.demo-head p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--fg-muted);
  max-width: none;
}

.demo-body {
  padding: 18px;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
}

textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  padding: 10px 12px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

textarea:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent-soft);
  outline-offset: 0;
}

.demo-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 0;
}

.demo-controls form {
  margin: 0;
}

.hint {
  font-size: 0.8125rem;
  color: var(--fg-faint);
  margin: 10px 0 0;
}

/* log timeline */

.log {
  margin: 18px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-code);
  max-height: 320px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.log:empty {
  display: none;
}

.log-line {
  display: flex;
  gap: 10px;
  padding: 5px 12px;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}

.log-line:last-child {
  border-bottom: 0;
}

.log-line .t {
  color: var(--fg-faint);
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.log-line .m {
  min-width: 0;
  overflow-wrap: anywhere;
}

.log-line.ok .m {
  color: var(--ok);
}

.log-line.pending .m {
  color: var(--fg-faint);
}

.log-line.warn .m {
  color: var(--warn);
}

.log-status {
  margin: 14px 0 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--fg-muted);
}

.result {
  margin: 18px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.field {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.field .k {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--fg-faint);
  display: block;
  margin-bottom: 4px;
}

.field .v {
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.field .v.mono {
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.sentiment-positive {
  color: var(--ok);
}

.sentiment-negative {
  color: var(--warn);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chip {
  font-family: var(--mono);
  font-size: 0.75rem;
  border: 1px solid var(--line);
  background: var(--bg-sunken);
  border-radius: 3px;
  padding: 1px 6px;
}

.checks {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--fg-muted);
}

.checks li {
  padding: 2px 0;
}

.checks .pass {
  color: var(--ok);
}

.checks .fail {
  color: var(--warn);
}

/* ------------------------------------------------------------- technical */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  margin-bottom: 14px;
}

th,
td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  font-size: 0.8125rem;
  font-family: var(--mono);
  font-weight: 500;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td code {
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

dl.spec {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(140px, max-content) 1fr;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.9375rem;
}

dl.spec dt {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--fg-muted);
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-sunken);
}

dl.spec dd {
  margin: 0;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
}

dl.spec dt:last-of-type,
dl.spec dd:last-of-type {
  border-bottom: 0;
}

/* --------------------------------------------------------------- pricing */

.price-card {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 460px;
}

.price-card .amount {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}

.price-card .amount span {
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--fg-muted);
  letter-spacing: 0;
}

.price-card ul {
  margin: 18px 0 22px;
  padding-left: 18px;
  color: var(--fg-muted);
  font-size: 0.9375rem;
}

.price-card li {
  margin-bottom: 6px;
}

.price-note {
  font-size: 0.8125rem;
  color: var(--fg-faint);
  margin: 12px 0 0;
  max-width: var(--measure);
}

/* ------------------------------------------------------------------- faq */

.faq {
  max-width: var(--measure);
}

.faq details {
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.faq summary {
  cursor: pointer;
  font-weight: 500;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  color: var(--fg-faint);
  font-family: var(--mono);
  flex: 0 0 auto;
}

.faq details[open] summary::after {
  content: "\2212";
}

.faq details p {
  margin: 10px 0 0;
  color: var(--fg-muted);
  font-size: 0.9375rem;
}

/* ---------------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.site-footer .wrap {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: baseline;
}

.site-footer .spacer {
  margin-left: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 560px) {
  h1 {
    font-size: 1.625rem;
  }

  .facts div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .facts div:last-child {
    border-bottom: 0;
  }

  dl.spec {
    grid-template-columns: 1fr;
  }

  dl.spec dt {
    border-bottom: 0;
    padding-bottom: 2px;
  }

  ol.steps > li {
    padding-left: 46px;
  }
}
