/* Additions on top of Pico; everything else is its defaults. */

/* Brand palette, shared with logo.svg and favicon.svg. A sibling of real-enums' site: same
   layout and type, its own colours. */
:root {
  --brand-indigo: #4f46e5;
  --brand-coral: #fb7185;
  --brand-ink: #0f172a;
  --brand-ink-light: #f8fafc;
  --pico-font-family-sans-serif:
    Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --pico-font-family: var(--pico-font-family-sans-serif);
}

/* Same selectors as Pico so these win by source order. */
:root:not([data-theme='dark']),
[data-theme='light'] {
  --pico-primary: #4f46e5;
  --pico-primary-background: #4f46e5;
  --pico-primary-border: #4f46e5;
  --pico-primary-underline: rgb(79 70 229 / 0.5);
  --pico-primary-hover: #4338ca;
  --pico-primary-hover-background: #4338ca;
  --pico-primary-hover-border: #4338ca;
  --pico-primary-hover-underline: #4338ca;
  --pico-primary-focus: rgb(79 70 229 / 0.4);
  --pico-primary-inverse: #fff;
  --pico-text-selection-color: rgb(79 70 229 / 0.25);
}

@media only screen and (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --pico-primary: #a5b4fc;
    --pico-primary-background: #4f46e5;
    --pico-primary-border: #4f46e5;
    --pico-primary-underline: rgb(165 180 252 / 0.5);
    --pico-primary-hover: #c7d2fe;
    --pico-primary-hover-background: #4338ca;
    --pico-primary-hover-border: #4338ca;
    --pico-primary-hover-underline: #c7d2fe;
    --pico-primary-focus: rgb(165 180 252 / 0.4);
    --pico-primary-inverse: #fff;
    --pico-text-selection-color: rgb(165 180 252 / 0.3);
  }
}

[data-theme='dark'] {
  --pico-primary: #a5b4fc;
  --pico-primary-background: #4f46e5;
  --pico-primary-border: #4f46e5;
  --pico-primary-underline: rgb(165 180 252 / 0.5);
  --pico-primary-hover: #c7d2fe;
  --pico-primary-hover-background: #4338ca;
  --pico-primary-hover-border: #4338ca;
  --pico-primary-hover-underline: #c7d2fe;
  --pico-primary-focus: rgb(165 180 252 / 0.4);
  --pico-primary-inverse: #fff;
  --pico-text-selection-color: rgb(165 180 252 / 0.3);
}

/* Spacing scale. Every gap on the page comes from these. */
:root {
  --space-gutter: clamp(1rem, 4vw, 2rem);
  --space-section: clamp(4rem, 9vw, 7rem);
  --space-block: 2.5rem; /* section intro to its content */
  --space-gap: 1.5rem; /* between cards in a grid */
  --measure: 42rem; /* readable line length */
}

/* One fluid content width for nav, hero, sections and footer, replacing Pico's
   stepped max-widths, which drop the side padding from 576px up. */
.container {
  max-width: calc(1200px + 2 * var(--space-gutter));
  padding-inline: var(--space-gutter);
}

/* Eyebrow labels above headings */
.eyebrow {
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pico-primary);
}

/* Sticky nav */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--pico-background-color);
  background: color-mix(in srgb, var(--pico-background-color) 80%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.site-nav > .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Keeps the nav on one row at phone width. */
@media (max-width: 575px) {
  .site-nav .wide-only {
    display: none;
  }
}

.site-nav a {
  color: var(--pico-muted-color);
  font-weight: 500;
}

.site-nav a:hover {
  color: var(--pico-color);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Hero band: dark in both schemes. */
.hero-band {
  --pico-color: #f8fafc;
  --pico-h1-color: #f8fafc;
  --pico-muted-color: #cbd5e1;
  --pico-primary: #a5b4fc;
  position: relative;
  isolation: isolate;
  padding-block: 0;
  overflow: hidden;
  background-color: #0b0b14;
  color: var(--pico-color);
}

/* Faint grid, faded out towards the edges. */
.hero-band::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgb(255 255 255 / 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 25%, transparent 75%);
  mask-image: radial-gradient(ellipse at 50% 40%, #000 25%, transparent 75%);
}

.hero-band::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(40rem 28rem at 75% 45%, rgb(79 70 229 / 0.28), transparent 70%);
}

.hero {
  display: grid;
  gap: clamp(2.5rem, 5vw, 4rem);
  align-items: center;
  padding-block: var(--space-section);
}

/* Lets the install pill scroll inside its column instead of widening the page. */
.hero > *,
.hero-copy > * {
  min-width: 0;
}

@media (min-width: 992px) {
  .hero {
    grid-template-columns: 1.05fr 1fr;
  }
}

.hero h1 {
  margin-bottom: 1.25rem;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.gradient-text {
  background: linear-gradient(90deg, #a5b4fc, #fb7185);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  max-width: 36rem;
  margin-bottom: 2rem;
  font-size: 1.125rem;
  color: var(--pico-muted-color);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.hero-actions [role='button'] {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.hero-actions .ghost {
  --pico-background-color: transparent;
  --pico-border-color: rgb(255 255 255 / 0.25);
  --pico-color: #f8fafc;
}

.hero-actions .ghost:is(:hover, :focus-visible) {
  --pico-background-color: rgb(255 255 255 / 0.06);
  --pico-border-color: rgb(255 255 255 / 0.5);
  --pico-color: #fff;
}

.install {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 100%;
  width: fit-content;
  padding: 0.6rem 1.25rem;
  overflow-x: auto;
  border: 1px solid rgb(255 255 255 / 0.12);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.04);
  font-family: var(--pico-font-family-monospace);
  font-size: 0.9rem;
  white-space: nowrap;
}

.install .prompt {
  color: #64748b;
  user-select: none;
}

.install code {
  padding: 0;
  background: none;
  color: #e2e8f0;
  font-size: inherit;
}

.install-note {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #94a3b8;
}

/* Section rhythm: one gap between sections, never doubled. */
body > main {
  padding-block: 0 var(--space-section);
}

main > section {
  margin: 0;
  padding-top: var(--space-section);
}

main > section > h2 {
  margin-bottom: 1rem;
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

/* The intro paragraph under a heading: readable width, then a fixed gap. */
main > section > h2 + p {
  max-width: var(--measure);
  margin-bottom: var(--space-block);
  font-size: 1.0625rem;
  color: var(--pico-muted-color);
}

main > section > h2:not(:has(+ p)) {
  margin-bottom: var(--space-block);
}

main > section > h3 {
  margin-block: var(--space-block) 0.75rem;
}

main > section p {
  max-width: var(--measure);
}

/* Cards in a grid space by the grid gap, not their own margins. */
.grid {
  gap: var(--space-gap);
}

.grid > article,
.grid > pre,
.features article {
  margin: 0;
}

.grid + * {
  margin-top: var(--space-gap);
}

/* Use cases: stacked full width, so their code blocks have room. */
.use-cases {
  display: grid;
  gap: var(--space-gap);
}

.use-cases > article {
  margin: 0;
}

.use-cases pre:last-child,
.grid > pre {
  margin-bottom: 0;
}

details {
  margin-bottom: 0.5rem;
}

/* Features */
.features {
  display: grid;
  gap: var(--space-gap);
}

@media (min-width: 576px) {
  .features {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .features {
    grid-template-columns: repeat(4, 1fr);
  }
}

.features article {
  margin: 0;
  border: 1px solid var(--pico-muted-border-color);
  box-shadow: none;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease;
}

.features article:hover {
  border-color: var(--pico-primary-underline);
  transform: translateY(-2px);
}

.features h3 {
  margin-block: 1rem 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.features p {
  margin: 0;
  color: var(--pico-muted-color);
}

.icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--pico-primary);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (prefers-reduced-motion: reduce) {
  .features article {
    transition: none;
  }

  .features article:hover {
    transform: none;
  }
}

/* Footer */
body > footer {
  border-top: 1px solid var(--pico-muted-border-color);
  padding-block: 2.5rem;
  color: var(--pico-muted-color);
}

body > footer a {
  color: inherit;
}

/* Code blocks: one editor-style surface in both schemes. Pico pads the inner
   <code> and Prism pads the <pre>; only the <pre> pads here, so indents don't double. */
pre,
pre[class*='language-'] {
  margin: 0 0 var(--pico-typography-spacing-vertical);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  border: 1px solid rgb(255 255 255 / 0.08);
  border-radius: 12px;
  background: #0d1117;
  color: #e2e8f0;
  font-size: clamp(0.75rem, 0.65rem + 0.35vw, 0.875rem);
  line-height: 1.65;
  tab-size: 2;
}

pre > code,
pre > code[class*='language-'] {
  display: block;
  padding: 0;
  background: none;
  color: inherit;
  font-family: var(--pico-font-family-monospace);
  font-size: inherit;
  line-height: inherit;
  text-shadow: none;
  /* Wrap long lines instead of scrolling sideways. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Side-by-side code pairs only once each half is wide enough to read. */
@media (max-width: 1099px) {
  .grid:has(> article > pre, > pre) {
    grid-template-columns: 1fr;
  }
}

:root:not([data-theme='dark']) pre {
  border-color: transparent;
}

td img {
  display: block;
  margin-block: 0.15rem;
}

.hero code {
  padding: 0.05em 0.3em;
  background: rgb(255 255 255 / 0.08);
  color: inherit;
}

.features {
  margin-top: var(--space-block);
}

.install-block pre {
  margin-bottom: var(--space-gap);
}

/* The live demo, in a window frame. */
.demo-window {
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 14px;
  overflow: hidden;
  background: #11111d;
  box-shadow:
    0 30px 80px -20px rgb(79 70 229 / 0.55),
    0 0 0 1px rgb(255 255 255 / 0.04);
}

.demo-window .chrome {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid rgb(255 255 255 / 0.08);
  font-size: 0.75rem;
  color: #94a3b8;
}

.demo-window .chrome i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #334155;
}

.demo-window .chrome span {
  margin-left: auto;
  font-family: var(--pico-font-family-monospace);
}

.demo-window iframe {
  display: block;
  width: 100%;
  height: min(640px, 75vh);
  border: 0;
  background: #fff;
}

.demo-window.full iframe {
  height: 900px;
}

.selector-list code {
  white-space: nowrap;
}

.stamp {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: rgb(251 113 133 / 0.15);
  color: #e11d48;
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: middle;
}
