/* loomworks — site styles. Plain CSS, no build step. */

:root {
  --bg: #f7f8fa;
  --bg-elev: #ffffff;
  --bg-sunk: #eef1f5;
  --border: #dde2ea;
  --border-strong: #c6cdd8;
  --text: #0f1726;
  --text-muted: #4a5568;
  --text-faint: #6b7587;
  --accent: #0f766e;        /* warp: teal */
  --accent-strong: #115e59;
  --accent-soft: #d5f3ef;
  --weft: #a15c00;          /* weft: amber, darkened for contrast on light */
  --weft-soft: #fdf0d7;
  --danger: #b42318;

  --term-bg: #0b1220;
  --term-border: #1e293b;
  --term-text: #dbe4f0;
  --term-muted: #8391a7;
  --term-prompt: #2dd4bf;
  --term-ok: #86efac;
  --term-str: #f5b942;
  --term-key: #93c5fd;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 38, .06), 0 8px 24px rgba(15, 23, 38, .06);
  --maxw: 1160px;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070b14;
    --bg-elev: #0d1422;
    --bg-sunk: #0a101c;
    --border: #1b2537;
    --border-strong: #2a3850;
    --text: #e6ecf5;
    --text-muted: #a5b1c4;
    --text-faint: #7d8aa1;
    --accent: #2dd4bf;
    --accent-strong: #5eead4;
    --accent-soft: rgba(45, 212, 191, .12);
    --weft: #f5b942;
    --weft-soft: rgba(245, 185, 66, .12);
    --danger: #f97066;
    --term-bg: #060a12;
    --term-border: #1b2537;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .35);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.1rem, 5vw, 3.5rem); font-weight: 750; letter-spacing: -0.035em; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.25rem); font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
code, kbd, pre, samp { font-family: var(--font-mono); font-size: .9em; font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
:not(pre) > code {
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  padding: .08em .38em;
  border-radius: 5px;
  font-size: .85em;
  overflow-wrap: anywhere;
}

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: .5rem 1rem; z-index: 100;
}
.skip:focus { left: 1rem; top: 1rem; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
@media (max-width: 480px) { .wrap { padding: 0 16px; } }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.12rem; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand svg { width: 28px; height: 28px; flex: none; }
.brand .tld { color: var(--text-faint); font-weight: 500; }
.nav-links { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.nav-links a { color: var(--text-muted); font-size: .94rem; font-weight: 500; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--text); }
@media (max-width: 760px) {
  .nav { gap: 12px; }
  .nav-links { gap: 14px; }
  .nav-links .hide-sm { display: none; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: .7rem 1.1rem; border-radius: 10px;
  font-weight: 600; font-size: .95rem; line-height: 1;
  border: 1px solid transparent; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-primary { color: #04201d; } }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { border-color: var(--border-strong); color: var(--text); background: var(--bg-elev); }
.btn-ghost:hover { border-color: var(--text-faint); }
.btn svg { width: 18px; height: 18px; }

/* ---------- hero ---------- */
.hero { position: relative; padding: 72px 0 64px; overflow: hidden; }
.hero::before {
  /* faint woven grid in the background */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 60% at 70% 30%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 30%, #000 20%, transparent 75%);
  opacity: .55;
}
.hero-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 48px; align-items: center; }
@media (max-width: 940px) { .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 36px; } .hero { padding-top: 48px; } }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: .78rem; font-weight: 500; letter-spacing: .02em;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: .3rem .7rem; border-radius: 999px; margin-bottom: 20px;
}
.lede { font-size: clamp(1.05rem, 1.6vw, 1.22rem); color: var(--text-muted); max-width: 36em; }
.hero .cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 24px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 0; margin: 0; list-style: none; color: var(--text-faint); font-size: .88rem; }
.facts li { display: inline-flex; align-items: center; gap: 7px; }
.facts li::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--weft); }

/* ---------- terminal & code ---------- */
.term, .code {
  position: relative;
  background: var(--term-bg);
  color: var(--term-text);
  border: 1px solid var(--term-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 0;
}
.term-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 76px 10px 14px; border-bottom: 1px solid var(--term-border);
  font-family: var(--font-mono); font-size: .75rem; color: var(--term-muted);
}
.term-bar .dots { display: inline-flex; gap: 6px; margin-right: 6px; }
.term-bar .dots i { width: 10px; height: 10px; border-radius: 50%; background: #243044; display: block; }
.term-bar .title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term pre, .code pre {
  margin: 0; padding: 16px 18px 18px;
  overflow-x: auto;
  font-size: .84rem; line-height: 1.7;
  tab-size: 2;
}
.term pre code, .code pre code { font-size: inherit; background: none; border: 0; padding: 0; }
.p { color: var(--term-prompt); user-select: none; }
.o { color: var(--term-muted); }
.ok { color: var(--term-ok); }
.c { color: #6b7a92; font-style: italic; }
.s { color: var(--term-str); }
.k { color: var(--term-key); }
.copy {
  position: absolute; top: 7px; right: 8px;
  font: 500 .72rem/1 var(--font-mono);
  color: var(--term-muted); background: #111a2b;
  border: 1px solid var(--term-border); border-radius: 6px;
  padding: 6px 8px; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.copy:hover, .copy:focus-visible { color: var(--term-text); border-color: #3a4a66; }
.copy.done { color: var(--term-ok); }
.code .copy { top: 8px; }
.code-label {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 14px; padding-right: 80px; border-bottom: 1px solid var(--term-border);
  font: 500 .75rem var(--font-mono); color: var(--term-muted);
}

/* ---------- sections ---------- */
section { padding: 80px 0; }
section.tight { padding: 56px 0; }
.alt { background: var(--bg-elev); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { max-width: 760px; margin-bottom: 40px; }
.section-head p { color: var(--text-muted); font-size: 1.08rem; }
.kicker { font: 600 .78rem var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--weft); margin-bottom: 12px; display: block; }

/* build-system strip */
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 820px) { .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.chip {
  border: 1px solid var(--border); background: var(--bg-elev); border-radius: var(--radius-sm);
  padding: 14px 16px; min-width: 0;
}
.chip b { display: block; font-size: .98rem; }
.chip span { color: var(--text-faint); font-size: .85rem; }
.strip-note { color: var(--text-faint); font-size: .9rem; margin-top: 14px; }

/* feature grid */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 940px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid { grid-template-columns: minmax(0, 1fr); } }
.card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 22px 20px; min-width: 0;
  transition: border-color .15s;
}
.alt .card { background: var(--bg); }
.card:hover { border-color: var(--border-strong); }
.card .ic {
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 14px;
}
.card .ic.weft { background: var(--weft-soft); color: var(--weft); }
.card .ic svg { width: 20px; height: 20px; }
.card p { color: var(--text-muted); font-size: .95rem; margin-bottom: .6em; }
.card p:last-child { margin-bottom: 0; }
.card .cmdline { font-family: var(--font-mono); font-variant-ligatures: none; font-size: .8rem; color: var(--text-faint); overflow-wrap: anywhere; }

/* two-column split */
.split { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 48px; align-items: start; }
.split.rev { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
@media (max-width: 940px) { .split, .split.rev { grid-template-columns: minmax(0, 1fr); gap: 28px; } }
.checks { list-style: none; padding: 0; margin: 0 0 1.2em; }
.checks li { position: relative; padding-left: 28px; margin-bottom: 12px; color: var(--text-muted); }
.checks li b { color: var(--text); font-weight: 600; }
.checks li::before {
  content: ""; position: absolute; left: 2px; top: .45em; width: 14px; height: 14px; border-radius: 4px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.checks li::after {
  content: ""; position: absolute; left: 6.5px; top: calc(.45em + 3px); width: 4px; height: 7px;
  border: solid var(--accent); border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* how-it-works flow */
.flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto minmax(0, 1.1fr) auto minmax(0, 1fr); gap: 12px; align-items: stretch; margin-bottom: 40px; }
.flow .node {
  border: 1px solid var(--border); background: var(--bg-elev); border-radius: var(--radius-sm);
  padding: 14px; min-width: 0;
}
.alt .flow .node { background: var(--bg); }
.flow .node h4 { font-size: .92rem; margin-bottom: .35em; }
.flow .node p { font-size: .82rem; color: var(--text-muted); margin: 0; }
.flow .node code { font-size: .75rem; }
.flow .node.profile { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); background: var(--accent-soft); }
.flow .node.verbs { border-style: dashed; }
.flow .arrow { display: grid; place-items: center; color: var(--text-faint); font-family: var(--font-mono); }
@media (max-width: 1000px) {
  .flow { grid-template-columns: minmax(0, 1fr); }
  .flow .arrow { transform: rotate(90deg); height: 20px; }
}

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; color: var(--text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
td code { white-space: nowrap; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-elev); }
.table-wrap table tr:last-child td { border-bottom: 0; }

.note {
  border: 1px solid var(--border); border-left: 3px solid var(--weft);
  background: var(--weft-soft); border-radius: var(--radius-sm);
  padding: 12px 16px; color: var(--text-muted); font-size: .92rem; margin: 1.2em 0;
}
.note b { color: var(--text); }

/* install tabs (no-JS friendly: all panels visible without JS) */
.tabs [role="tablist"] { display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs [role="tab"] {
  font: 500 .85rem var(--font-sans); color: var(--text-muted); background: transparent;
  border: 1px solid transparent; border-radius: 8px; padding: .45rem .8rem; cursor: pointer;
}
.tabs [role="tab"][aria-selected="true"] { color: var(--text); background: var(--bg-elev); border-color: var(--border); }
.tabs [role="tabpanel"] + [role="tabpanel"] { margin-top: 12px; }
.tabs.js [role="tabpanel"] + [role="tabpanel"] { margin-top: 0; }
.tabs.js [role="tabpanel"][hidden] { display: none; }

/* final CTA */
.cta-band { text-align: center; }
.cta-band .cta { justify-content: center; display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.cta-band p { color: var(--text-muted); max-width: 40em; margin-left: auto; margin-right: auto; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 40px 0 48px; color: var(--text-faint); font-size: .9rem; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 28px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .footer-grid > :first-child { grid-column: 1 / -1; } }
.site-footer h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: .8em; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: .45em; }
.site-footer a { color: var(--text-faint); }
.site-footer a:hover { color: var(--text); }
.fineprint { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); font-size: .82rem; }

/* ---------- docs layout ---------- */
.docs { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 48px; padding-top: 48px; padding-bottom: 80px; }
@media (max-width: 900px) { .docs { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 28px; } .toc ol + h4 { margin-top: 1em; } }
.toc { position: sticky; top: 88px; align-self: start; font-size: .9rem; }
.toc h4 { font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); margin: 0 0 .6em; }
.toc ol { list-style: none; margin: 0 0 1.4em; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 4px 0 4px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--text-muted); }
.toc a:hover { color: var(--text); text-decoration: none; border-left-color: var(--border-strong); }
@media (max-width: 900px) {
  .toc { position: static; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--bg-elev); }
  .toc ol { columns: 2; column-gap: 16px; margin-bottom: 0; border-left: 0; }
  .toc a { padding-left: 0; border-left: 0; }
}
@media (max-width: 420px) { .toc ol { columns: 1; } }
.prose { min-width: 0; max-width: 780px; }
.prose h1 { font-size: clamp(2rem, 4vw, 2.6rem); }
.prose h2 { font-size: 1.55rem; margin-top: 2.4em; padding-top: .6em; border-top: 1px solid var(--border); scroll-margin-top: 84px; }
.prose h2:first-of-type { border-top: 0; margin-top: 1.4em; }
.prose h3 { margin-top: 1.8em; scroll-margin-top: 84px; }
.prose p, .prose li { color: var(--text-muted); }
.prose strong { color: var(--text); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .4em; }
.prose .term, .prose .code, .prose .table-wrap { margin: 1.1em 0 1.4em; }

/* ---------- 404 ---------- */
.notfound { min-height: 62vh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; text-align: center; padding: 64px 0; }
.notfound > div { width: 100%; min-width: 0; }
.notfound .big { font: 700 clamp(4rem, 14vw, 7rem)/1 var(--font-mono); letter-spacing: -0.04em; color: var(--accent); margin-bottom: .1em; }
.notfound .term { max-width: 560px; margin: 24px auto; text-align: left; }
