/* CopperWorks site. Plain CSS.
   Theme: dark only. Every colour is a token on :root.
   Balance: mostly charcoal, warm neutrals in the text, copper as the accent and
   in the hero gradient. Type: Geist and Geist Mono, served from /static/fonts. */

@font-face {
  font-family: "Geist";
  src: url("/static/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/static/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --bg: #0e1013;
  --bg-alt: #13161a;
  --surface: #171a1f;
  --fg: #edebe7;
  --muted: #9ca0a7;
  --line: #252a31;
  --copper: #d0834f;
  --copper-strong: #e9a476;
  --copper-soft: #2a1e17;
  --on-copper: #1a0f08;

  /* Hero: base colour sweeping into copper. */
  --hero-a: #0e1013;
  --hero-b: #17171a;
  --hero-c: #4f2e1f;
  --hero-d: #b06a40;
  --ink-a: #c47a4a;
  --ink-b: #f6d2b2;
  --pad: #e3a173;

  --code-bg: #0a0b0d;
  --code-fg: #e6e2dc;
  --code-comment: #868d98;
  --code-keyword: #e59a62;
  --code-string: #a9c98f;
  --code-number: #f0c674;

  --radius: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3),
    0 12px 32px rgb(0 0 0 / 0.4);

  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01";
}

main { flex: 1; }

a { color: var(--copper-strong); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--copper); }

h1, h2, h3 { line-height: 1.12; text-wrap: balance; font-weight: 600; }
h1 { font-size: clamp(2.25rem, 1.4rem + 3.6vw, 3.9rem); letter-spacing: -0.035em; margin: 0 0 1.1rem; }
h2 { font-size: clamp(1.5rem, 1.15rem + 1.2vw, 2.1rem); letter-spacing: -0.025em; margin: 2.75rem 0 0.75rem; }
h3 { font-size: 1.08rem; letter-spacing: -0.01em; margin: 0 0 0.4rem; }
p { margin: 0 0 1rem; }

code {
  font: 0.88em/1.5 var(--mono);
  background: var(--copper-soft);
  padding: 0.12em 0.35em;
  border-radius: 5px;
}

.wrap { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }
.wrap.narrow { max-width: 46rem; }

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

/* Header and footer */

.site-header {
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(1.4) blur(10px);
}
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem 1rem; min-height: 3.75rem; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.55rem;
  color: var(--fg); text-decoration: none; font-weight: 600; font-size: 1.05rem; letter-spacing: -0.01em;
}
.brand:hover { color: var(--fg); }
.site-header nav { display: flex; align-items: center; gap: 0.25rem 1.25rem; flex-wrap: wrap; }
.site-header nav a { color: var(--muted); text-decoration: none; font-size: 0.93rem; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--fg); }
.site-header nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--copper); }


.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 5rem; padding: 1.5rem 0;
  color: var(--muted); font-size: 0.85rem;
}
.footer-row { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-row p { margin: 0; }

/* Buttons */

.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 2rem; }
.button {
  display: inline-block; padding: 0.7rem 1.2rem; border-radius: 9px;
  border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--fg); text-decoration: none; font-weight: 550; font-size: 0.97rem;
}
.button:hover { border-color: var(--copper); color: var(--fg); }
.button.primary { background: var(--copper); border-color: var(--copper); color: var(--on-copper); }
.button.primary:hover { background: var(--copper-strong); border-color: var(--copper-strong); color: var(--on-copper); }

/* Hero: the copper gradient sweep with routed traces. */

.hero {
  position: relative; overflow: hidden;
  padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(3rem, 7vw, 5.5rem);
  background:
    radial-gradient(120% 90% at 100% 100%, color-mix(in srgb, var(--hero-d) 55%, transparent), transparent 60%),
    linear-gradient(112deg, var(--hero-a) 0%, var(--hero-b) 42%, var(--hero-c) 74%, var(--hero-d) 100%);
  border-bottom: 1px solid var(--line);
}
.hero .wrap { position: relative; z-index: 1; }
.hero h1 { max-width: 15ch; }
.hero .lede { max-width: 36rem; }
.hero .traces {
  position: absolute; z-index: 0; right: max(-4rem, calc(50% - 46rem)); top: 50%;
  width: min(48rem, 64vw); transform: translateY(-50%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 42%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 42%);
}
.eyebrow {
  color: var(--copper-strong); font-weight: 550; font-size: 0.8rem;
  letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 1rem;
}
.lede { font-size: 1.16rem; color: var(--muted); max-width: 40rem; }

.traces .routes path {
  fill: none; stroke: url(#trace-ink); stroke-width: 6;
  stroke-linecap: round; stroke-linejoin: round; opacity: 0.85;
  stroke-dasharray: 1; stroke-dashoffset: 0;
}
.traces .ink-a { stop-color: var(--ink-a); }
.traces .ink-b { stop-color: var(--ink-b); }
.traces .pads rect { fill: var(--pad); opacity: 0.95; }
.traces .vias circle { fill: none; stroke: var(--pad); stroke-width: 4; }
.traces .courtyard { fill: none; stroke: var(--ink-b); stroke-opacity: 0.35; stroke-width: 1.5; stroke-dasharray: 5 5; }

@media (prefers-reduced-motion: no-preference) {
  .traces .routes path {
    stroke-dashoffset: 1;
    animation: route 1.6s cubic-bezier(0.5, 0, 0.2, 1) forwards;
    animation-delay: calc(0.25s + var(--n) * 0.07s);
  }
  @keyframes route { to { stroke-dashoffset: 0; } }
}

@media (max-width: 52rem) {
  .hero .traces { width: 120vw; right: -45vw; opacity: 0.18; }
}

/* Home */

.demo { padding: 3.5rem 0 3rem; }
.app-window {
  margin: 0; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); overflow: hidden;
}
.titlebar {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--line);
  background: var(--bg-alt); font-size: 0.8rem; color: var(--muted);
}
.titlebar span { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--line); }
.titlebar b { font-weight: 500; margin-left: 0.6rem; }
.panes { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.pane { min-width: 0; }
.pane .code { margin: 0; border-radius: 0; height: 100%; }
.pane.board {
  display: grid; place-items: center; padding: 2rem; text-align: center;
  color: var(--muted); font-size: 0.95rem; min-height: 14rem;
  background:
    radial-gradient(circle, var(--line) 1px, transparent 1.5px) 0 0 / 16px 16px,
    var(--bg-alt);
}
.pane.board p { max-width: 18rem; margin: 0; background: var(--surface); padding: 0.75rem 1rem; border-radius: 8px; border: 1px solid var(--line); }
.app-window figcaption {
  padding: 0.75rem 1rem; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 0.9rem;
}
@media (max-width: 52rem) {
  .panes { grid-template-columns: 1fr; }
}

.loop, .features, .audience { padding: 2.5rem 0; }
.loop h2, .features h2, .audience h2 { margin-top: 0; }

.steps {
  list-style: none; padding: 0; margin: 1.5rem 0 0; counter-reset: step;
  display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}
.steps li {
  counter-increment: step; padding: 1.35rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.steps li::before {
  content: counter(step, decimal-leading-zero); display: block; margin-bottom: 0.9rem;
  font: 500 0.8rem/1 var(--mono); color: var(--copper-strong); letter-spacing: 0.04em;
}
.steps p, .grid p, .cards p { color: var(--muted); margin: 0; }

.grid {
  display: grid; gap: 1px; margin-top: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.grid article { padding: 1.5rem; background: var(--surface); }

.cards {
  list-style: none; padding: 0; margin: 1.5rem 0 0;
  display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}
.cards li {
  padding: 1.35rem; border-radius: var(--radius); border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--surface) 55%, var(--copper-soft));
}

.pricing-note { padding: 3rem 0 0; text-align: center; }
.pricing-note .wrap {
  padding-top: 2.5rem; padding-bottom: 2.5rem; border-radius: var(--radius);
  background: linear-gradient(112deg, var(--hero-b), var(--copper-soft));
  border: 1px solid var(--line);
}
.pricing-note h2 { margin-top: 0; }
.pricing-note p { color: var(--muted); }
.pricing-note p:last-child { margin-bottom: 0; }

/* Inner pages */

.page-head {
  padding: clamp(3rem, 7vw, 5rem) 0 1.5rem; margin-bottom: 1rem;
  background: linear-gradient(112deg, var(--hero-a) 30%, var(--hero-b) 65%, color-mix(in srgb, var(--hero-c) 55%, var(--hero-b)));
  border-bottom: 1px solid var(--line);
}
.prose { padding: 0.5rem 0; }
.prose p, .prose li { max-width: 42rem; }
.numbered { padding-left: 1.25rem; }
.numbered li { margin-bottom: 0.4rem; }
.note { color: var(--muted); font-size: 0.92rem; }

/* Code */

pre.code {
  margin: 1.25rem 0; padding: 1.1rem 1.25rem; overflow-x: auto;
  background: var(--code-bg); color: var(--code-fg);
  border-radius: var(--radius); font: 0.8rem/1.65 var(--mono);
}
pre.code code { background: none; padding: 0; color: inherit; font: inherit; }
pre.code .c { color: var(--code-comment); }
pre.code .k { color: var(--code-keyword); }
pre.code .s { color: var(--code-string); }
pre.code .n { color: var(--code-number); }

/* Download */

.platforms {
  list-style: none; padding: 0; margin: 0 0 1.5rem;
  display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}
.platforms li { padding: 1.35rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.platforms h2 { margin: 0 0 0.25rem; font-size: 1.25rem; }
.platforms .status { margin: 0; color: var(--muted); }

/* Licensing */

.table-scroll { overflow-x: auto; margin: 0.5rem 0 1rem; }
table.compare { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.compare th, .compare td { padding: 0.8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.compare thead th { font-size: 0.85rem; color: var(--muted); font-weight: 550; }
.compare tbody th { font-weight: 450; }
.compare td { white-space: nowrap; }
@media (max-width: 34rem) {
  .compare td { white-space: normal; }
}

/* Lay reference */

.reference-list { list-style: none; padding: 0; margin: 0 0 2rem; display: grid; gap: 0.75rem; }
.reference-list li { padding: 1.1rem 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.reference-list a { font-weight: 600; font-size: 1.08rem; text-decoration: none; }
.reference-list p { margin: 0.25rem 0 0; color: var(--muted); }

.reference h2 { font-size: 1.45rem; margin-top: 2.25rem; }
.reference h3 { margin-top: 1.5rem; }

figure.example { margin: 1.5rem 0 2rem; }
figure.example figcaption { margin-top: 0.6rem; color: var(--muted); font-size: 0.92rem; }

cw-playground {
  display: block;
  --cw-bg: var(--bg-alt);
  --cw-fg: var(--fg);
  --cw-muted: var(--muted);
  --cw-border: var(--line);
  --cw-card: var(--surface);
  --cw-accent: var(--copper);
  --cw-font: var(--sans);
  --cw-mono: var(--mono);
  --cw-height: 400px;
}
/* Until the element is ready: its frame, so the page does not jump. */
cw-playground:not(:defined) {
  min-height: 470px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
cw-playground:not(:defined) > * { display: none; }

.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--line); font-size: 0.95rem; }
.pager a { text-decoration: none; }
