/* livewire-rust site: one file, no build step, no webfonts, no framework. Layout after the
   laserstack site; palette and identity after Livewire. */
:root {
  color-scheme: dark;
  --bg: #0a0c10;
  --panel: #10141a;
  --panel-2: #151a22;
  --line: #212832;
  --fg: #e9edf3;
  --muted: #949fae;
  --accent: #7c3aed;
  --accent-2: #7dd3fc;
  --warn: #fbbf24;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 12px;
  --maxw: 72rem;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #fcfdfe;
    --panel: #ffffff;
    --panel-2: #f4f6f9;
    --line: #e2e6ec;
    --fg: #12161c;
    --muted: #5b6674;
    --accent: #6d28d9;
    --accent-2: #0369a1;
    --warn: #a16207;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.65 var(--sans); text-rendering: optimizeLegibility; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-top: 2.4rem; }
h3 { font-size: 1.1rem; margin-top: 1.6rem; }
p { margin: 0 0 1rem; }
code, kbd, pre { font-family: var(--mono); font-size: .92em; }
code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: .1em .35em; }
pre { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; overflow-x: auto; margin: 0 0 1rem; }
pre code { background: none; border: 0; padding: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 3rem 0; }
.muted { color: var(--muted); }

/* header */
header.site { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
header.site .wrap { display: flex; align-items: center; gap: 1rem; min-height: 3.5rem; }
.brand { display: flex; align-items: center; gap: .55rem; color: var(--fg); font-weight: 700; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand svg { display: block; }
.brand-dim { color: var(--muted); font-weight: 500; }
nav.site { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .9rem; font-size: .93rem; }
nav.site a { color: var(--muted); }
nav.site a[aria-current="page"], nav.site a:hover { color: var(--fg); text-decoration: none; }

/* hero */
.hero { padding: 4rem 0 2.5rem; border-bottom: 1px solid var(--line); }
.hero .lede { font-size: clamp(1.05rem, 2.2vw, 1.3rem); color: var(--muted); max-width: 46rem; }
.eyebrow { font: 600 .8rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.6rem; }
.btn { display: inline-block; padding: .6rem 1rem; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); font-weight: 600; font-size: .95rem; }
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.hero-meta { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; color: var(--muted); font-size: .92rem; margin: 1.4rem 0 0; }

/* sections */
section { padding: 3rem 0; border-bottom: 1px solid var(--line); }
section[id] { scroll-margin-top: 4.2rem; }
section > .wrap > p.section-lede { color: var(--muted); max-width: 46rem; }
.kicker { font: 600 .8rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: .8rem; }

/* cards and grids */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.2rem; }
.card h3 { margin: .1rem 0 .35rem; }
.card p { color: var(--muted); margin: 0; font-size: .95rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .6rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.15rem; }
.stat b { display: block; font: 700 1.6rem/1.1 var(--mono); }
.stat span { display: block; color: var(--muted); font-size: .88rem; margin-top: .35rem; }

/* tables */
table { width: 100%; border-collapse: collapse; margin: 0 0 1rem; font-size: .93rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }
tbody tr:last-child td { border-bottom: 0; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin-bottom: 1rem; }
.table-scroll table { margin: 0; }
.table-scroll th:first-child, .table-scroll td:first-child { padding-left: 1rem; }
.table-scroll th:last-child, .table-scroll td:last-child { padding-right: 1rem; }

/* docs layout */
.docs-layout { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 2.5rem; padding-top: 2.5rem; padding-bottom: 4rem; }
.docs-layout main, .docs-layout article { min-width: 0; }
aside.toc { position: sticky; top: 4.6rem; align-self: start; display: flex; flex-direction: column; gap: .1rem; font-size: .93rem; }
aside.toc .toc-title { font: 600 .78rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: .4rem 0 .5rem; }
aside.toc a { color: var(--muted); padding: .32rem .55rem; border-radius: 8px; border-left: 2px solid transparent; }
aside.toc a:hover { color: var(--fg); text-decoration: none; background: var(--panel); }
aside.toc a[aria-current="page"] { color: var(--fg); border-left-color: var(--accent); background: var(--panel); }
.prose { max-width: 46rem; }
.prose > :first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.2rem; margin: 0 0 1rem; }
.prose li { margin-bottom: .35rem; }
.prose li > ul { margin-top: .35rem; }

/* callouts */
.callout { border: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--panel); border-radius: var(--radius); padding: .9rem 1rem; margin: 0 0 1rem; }
.callout.warn { border-left-color: var(--warn); }
.callout p:last-child { margin-bottom: 0; }
.callout strong { color: var(--fg); }

/* a runnable example: the code that defines it beside the page that plays it */
.run { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 0 0 1.5rem; background: var(--panel); }
.run .code { min-width: 0; display: flex; flex-direction: column; }
.run .kind { padding: .5rem .9rem; border-bottom: 1px solid var(--line); font: 600 .74rem/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.run .code pre { margin: 0; border: 0; border-radius: 0; flex: 1; font-size: .82rem; max-height: 26rem; overflow: auto; }
.run .live { min-width: 0; border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.run .live header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .5rem .9rem; border-bottom: 1px solid var(--line); font: 600 .74rem/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.run .live header a { letter-spacing: .04em; text-transform: none; font-family: var(--sans); font-weight: 500; }
.run .live iframe { display: block; width: 100%; border: 0; background: var(--panel); }
@media (max-width: 860px) {
  .run { grid-template-columns: 1fr; }
  .run .live { border-left: 0; border-top: 1px solid var(--line); }
}

/* cards and steps keep an identifier whole, so `#` never ends a line alone */
.card code, .steps code { white-space: nowrap; }

/* numbered steps */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
.steps li { counter-increment: step; position: relative; padding: .85rem 1rem .85rem 3rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.steps li::before { content: counter(step); position: absolute; left: 1rem; top: .8rem; font: 700 .85rem/1.6 var(--mono); color: var(--accent); }
.steps strong { color: var(--fg); }

/* footer */
footer.site { padding: 2.5rem 0; color: var(--muted); font-size: .92rem; }
footer.site p { margin: 0 0 .35rem; }

@media (max-width: 54rem) {
  .docs-layout { grid-template-columns: 1fr; gap: 1rem; }
  aside.toc { position: static; flex-direction: row; flex-wrap: wrap; gap: .25rem; }
  aside.toc .toc-title { width: 100%; }
  aside.toc a { border-left: 0; border: 1px solid var(--line); border-radius: 999px; padding: .25rem .6rem; }
  aside.toc a[aria-current="page"] { border-color: var(--accent); }
}

/* --- ambient background: slow glows and a drifting diagonal hatch, behind the content,
   off for reduced motion. The violet accent gives the page its own weather. --- */
html::before, html::after, body::before, body::after {
  content: ""; position: fixed; z-index: -1; pointer-events: none; will-change: transform;
}
html::before {
  width: 80vmax; height: 80vmax; left: -28vmax; top: -34vmax; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 13%, transparent), transparent 72%);
  animation: glow-a 18s ease-in-out infinite alternate;
}
html::after {
  width: 70vmax; height: 70vmax; right: -26vmax; top: 18vh; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 72%);
  animation: glow-b 22s ease-in-out infinite alternate;
}
body::after {
  width: 60vmax; height: 60vmax; left: 8vw; bottom: -34vmax; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 7%, transparent), transparent 72%);
  animation: glow-c 26s ease-in-out infinite alternate;
}
body::before {
  inset: -40vmax;
  background-image: repeating-linear-gradient(125deg, color-mix(in srgb, var(--fg) 4%, transparent) 0 1px, transparent 1px 104px);
  animation: hatch 26s linear infinite;
}
@keyframes glow-a { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(18vw, 14vh, 0) scale(1.28); } }
@keyframes glow-b { from { transform: translate3d(0, 0, 0) scale(1.08); } to { transform: translate3d(-16vw, -18vh, 0) scale(.9); } }
@keyframes glow-c { from { transform: translate3d(0, 0, 0) scale(.94); } to { transform: translate3d(15vw, -16vh, 0) scale(1.2); } }
@keyframes hatch { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(256px, 179px, 0); } }
@media (prefers-color-scheme: light) {
  html::before { background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 8%, transparent), transparent 72%); }
  html::after { background: radial-gradient(closest-side, color-mix(in srgb, var(--accent-2) 7%, transparent), transparent 72%); }
  body::after { background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 5%, transparent), transparent 72%); }
  body::before { background-image: repeating-linear-gradient(125deg, color-mix(in srgb, var(--fg) 3%, transparent) 0 1px, transparent 1px 104px); }
}
@media (prefers-reduced-motion: reduce) {
  html::before, html::after, body::before, body::after { animation: none; }
}
