/* loom.luciaos.com — one stylesheet, no imports, no webfonts.
 *
 * The same dress luciaos.com and luce.luciaos.com wear, because they
 * are one house: warm cream paper, warm near-black ink, taupe for
 * tracked-out uppercase labels, one rust accent, a high-contrast
 * editorial serif on display text over a system sans for prose.  The
 * custom properties below are the language site's, value for value,
 * so a colour fixed in one place can be fixed in the other by
 * copying.
 *
 * Two themes from one set of properties: the system preference
 * decides by default, and the toggle stamps data-theme on <html> to
 * win in either direction.  The dark theme is designed, not inverted.
 *
 * What is *not* here is what this site does not have yet: no left
 * section list, no on-this-page rail, no search.  Six pages read
 * top to bottom in one column.  When there are enough pages to need
 * a section list, the language site's stylesheet already has one.
 */

:root {
  color-scheme: light;
  --ink: #1e1b16;
  --ink-soft: #5b5547;
  --ink-faint: #8a8275;
  --paper: #faf8f4;
  --paper-soft: #f2eee5;
  --paper-code: #fffefb;
  --line: #e5dfd3;
  --line-soft: #eeeadf;
  --accent: #a34e21;
  --accent-soft: #f4e7da;
  --link: #a34e21;
  --bad: #a03434;
  --bad-soft: #f8ecea;
  --good: #5f7038;
  --shadow: rgba(30, 27, 22, 0.2);

  --tok-comment: #8a8275;
  --tok-string: #6a7a3f;
  --tok-number: #2e6e79;
  --tok-keyword: #a34e21;
  --tok-verb: #8d3c6a;
  --tok-type: #40618f;
  --tok-builtin: #7d6b52;
  --tok-decl: #1e1b16;

  --prose: 44rem;
  --bar: 3.5rem;

  --serif: "Didot", "Bodoni 72", "Playfair Display", Georgia,
    "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #ece5d8;
    --ink-soft: #b9af9d;
    --ink-faint: #93897a;
    --paper: #17140f;
    --paper-soft: #211d16;
    --paper-code: #1d1913;
    --line: #302a20;
    --line-soft: #272218;
    --accent: #d97c45;
    --accent-soft: #2d2118;
    --link: #d97c45;
    --bad: #de8877;
    --bad-soft: #2c1d18;
    --good: #a7b97b;
    --shadow: rgba(0, 0, 0, 0.55);

    --tok-comment: #857c6c;
    --tok-string: #abbe7d;
    --tok-number: #7cbcb0;
    --tok-keyword: #e0915c;
    --tok-verb: #d093bb;
    --tok-type: #93add6;
    --tok-builtin: #b7a586;
    --tok-decl: #ece5d8;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --ink: #1e1b16; --ink-soft: #5b5547; --ink-faint: #8a8275;
  --paper: #faf8f4; --paper-soft: #f2eee5; --paper-code: #fffefb;
  --line: #e5dfd3; --line-soft: #eeeadf;
  --accent: #a34e21; --accent-soft: #f4e7da;
  --link: #a34e21; --bad: #a03434; --bad-soft: #f8ecea; --good: #5f7038;
  --shadow: rgba(30, 27, 22, 0.2);
  --tok-comment: #8a8275; --tok-string: #6a7a3f; --tok-number: #2e6e79;
  --tok-keyword: #a34e21; --tok-verb: #8d3c6a; --tok-type: #40618f;
  --tok-builtin: #7d6b52; --tok-decl: #1e1b16;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #ece5d8; --ink-soft: #b9af9d; --ink-faint: #93897a;
  --paper: #17140f; --paper-soft: #211d16; --paper-code: #1d1913;
  --line: #302a20; --line-soft: #272218;
  --accent: #d97c45; --accent-soft: #2d2118;
  --link: #d97c45; --bad: #de8877; --bad-soft: #2c1d18; --good: #a7b97b;
  --shadow: rgba(0, 0, 0, 0.55);
  --tok-comment: #857c6c; --tok-string: #abbe7d; --tok-number: #7cbcb0;
  --tok-keyword: #e0915c; --tok-verb: #d093bb; --tok-type: #93add6;
  --tok-builtin: #b7a586; --tok-decl: #ece5d8;
}

/* --------------------------------------------------------------- base */

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

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--link); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }

.skip {
  position: absolute; left: -100vw; top: 0; z-index: 50;
  background: var(--paper); padding: .5rem 1rem; border: 1px solid var(--line);
}
.skip:focus { left: 0; }

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

/* The bar luciaos.com wears and luce.luciaos.com wears: the serif
 * wordmark on the left, the tracked-out uppercase nav in the middle,
 * the cross-links and one quiet toggle on the right. */
header.top {
  position: sticky; top: 0; z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 1.25rem;
  height: var(--bar);
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: saturate(1.3) blur(8px);
  border-bottom: 1px solid var(--line);
}

.mark {
  justify-self: start;
  font-family: var(--serif);
  font-size: 1.35rem; letter-spacing: .01em; color: var(--ink);
}
.mark:hover { text-decoration: none; }

nav.tabs {
  justify-self: center; min-width: 0; max-width: 100%;
  display: flex; gap: 1.5rem; overflow-x: auto;
}
nav.tabs a {
  padding: .35rem 0;
  color: var(--ink-faint); white-space: nowrap;
  font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  border-bottom: 1px solid transparent;
  transition: color .25s ease;
}
nav.tabs a:hover { color: var(--ink); text-decoration: none; }
nav.tabs a.here { color: var(--ink); border-bottom-color: var(--accent); }

.tools { justify-self: end; display: flex; align-items: center; gap: .9rem; }
a.cross {
  font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-faint); white-space: nowrap;
  transition: color .25s ease;
}
a.cross:hover { color: var(--ink); text-decoration: none; }

#theme {
  width: 2rem; height: 2rem; padding: 0;
  font-size: 1.05rem; line-height: 1; cursor: pointer;
  color: var(--ink-faint);
  background: none; border: 0; border-radius: 50%;
  transition: color .25s ease;
}
#theme:hover { color: var(--ink); }
#theme:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --------------------------------------------------------------- shell */

/* One column, centered.  The language site puts a section list on the
 * left and a heading rail on the right, and the reading column sits
 * between them; with neither, the container is the reading column
 * plus its gutters, or the page reads as text pushed against a
 * margin. */
.shell {
  max-width: calc(var(--prose) + 3rem);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main { min-width: 0; padding: 2.6rem 0 4rem; }
article { max-width: var(--prose); }

/* -------------------------------------------------------------- prose */

h1, h2, h3, h4 { scroll-margin-top: calc(var(--bar) + 1rem); }

h1 {
  font-family: var(--serif);
  font-size: 2.7rem; line-height: 1.12; letter-spacing: 0;
  font-weight: 400; margin: 0 0 1.4rem;
}
h2 {
  font-family: var(--serif);
  font-size: 1.8rem; line-height: 1.2; letter-spacing: 0;
  font-weight: 400; margin: 2.8rem 0 .9rem;
  padding-bottom: .4rem; border-bottom: 1px solid var(--line);
}
h3 {
  font-family: var(--serif);
  font-size: 1.35rem; font-weight: 500; margin: 2.2rem 0 .7rem;
}
h4 {
  font-size: .8rem; font-weight: 600; margin: 1.8rem 0 .5rem;
  text-transform: uppercase; letter-spacing: .12em; color: var(--ink-soft);
}

p { margin: 0 0 1.1rem; }
article ul, article ol { margin: 0 0 1.1rem; padding-left: 1.4rem; }
li { margin-bottom: .35rem; }
li > ul, li > ol { margin: .35rem 0 .3rem; padding-left: 1.3rem; }

hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

blockquote {
  margin: 0 0 1.1rem; padding: .1rem 0 .1rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--ink-soft);
}
blockquote p:last-child { margin-bottom: 0; }

strong { font-weight: 620; color: var(--ink); }

code {
  font-family: var(--mono); font-size: .875em;
  padding: .1em .3em; border-radius: .25rem;
  background: var(--paper-soft);
}
a code { color: inherit; }

/* The one label this site adds to the house style: a paragraph or a
 * section that is about something not built.  Everywhere else the
 * pages describe the binary, so the exception has to be visible. */
.ahead {
  display: inline-block;
  margin-right: .5rem;
  padding: .05rem .5rem;
  font-family: var(--sans); font-size: .66rem; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; vertical-align: .1em;
}

/* ---------------------------------------------------------- code blocks */

/* A sample and everything that follows it — its output, a refusal — is
 * ONE composite panel: a single continuous rounded boundary with each
 * inner seam a hairline.  Copied from the language site so a
 * transcript looks the same on both. */
figure.sample {
  margin: 0 0 1.6rem;
  border-radius: .5rem;
  box-shadow: 0 18px 44px -34px var(--shadow);
}
figure.sample .code { box-shadow: none; }

.cap {
  display: flex; align-items: center; gap: .5rem;
  padding: .34rem .85rem;
  font-family: var(--mono); font-size: .74rem; letter-spacing: .02em;
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: .5rem .5rem 0 0;
  background: var(--paper-soft); color: var(--ink-faint);
}
.cap cite { font-style: normal; }
.cap.luc { background: var(--accent-soft); color: var(--accent); border-color: var(--line); }
.cap.out::before { content: "\25b8"; color: var(--good); }
.cap.bad { background: var(--bad-soft); color: var(--bad); }
.cap.bad::before { content: "\25a0"; font-size: .6em; }
.cap.shell::before { content: "$"; color: var(--ink-faint); }

.cap + .code { border-radius: 0 0 .5rem .5rem; }
.cap + .code:not(:last-child) { border-radius: 0; border-bottom: 0; }
.code + .cap { border-radius: 0; }

.code {
  position: relative;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--paper-code);
  box-shadow: 0 18px 44px -34px var(--shadow);
  overflow-x: auto;
  margin-bottom: 1.1rem;
}
figure.sample .code { margin-bottom: 0; }
.code:last-child { border-radius: 0 0 .5rem .5rem; }

.code pre { margin: 0; padding: .9rem 1.05rem; }
.code code, .code samp {
  display: block;
  font-family: var(--mono); font-size: .8125rem; line-height: 1.65;
  background: none; border: 0; padding: 0; white-space: pre;
  color: var(--ink);
}
.code.result { background: var(--paper-soft); box-shadow: none; }
.code.result samp { color: var(--ink-soft); }
.code.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 26%, transparent); box-shadow: none; }
.code.bad samp { color: var(--bad); }
.code kbd { font: inherit; color: var(--ink); font-weight: 560; }
.code .prompt { color: var(--ink-faint); user-select: none; }

button.copy {
  position: absolute; top: .4rem; right: .4rem; z-index: 2;
  padding: .12rem .45rem;
  font-family: var(--mono); font-size: .7rem; line-height: 1.5;
  color: var(--ink-faint); background: var(--paper);
  border: 1px solid var(--line); border-radius: .3rem;
  opacity: 0; cursor: pointer; transition: opacity .12s;
}
.code:hover button.copy, button.copy:focus-visible { opacity: 1; }
button.copy:hover { color: var(--ink); }

/* syntax classes, deliberately few — the same eight the language site
 * uses, so a Luce sample is coloured the same on either. */
.code .c { color: var(--tok-comment); font-style: italic; }
.code .s { color: var(--tok-string); }
.code .n { color: var(--tok-number); }
.code .k { color: var(--tok-keyword); font-weight: 560; }
.code .v { color: var(--tok-verb); font-weight: 620; }
.code .t { color: var(--tok-type); }
.code .b { color: var(--tok-builtin); }
.code .d { color: var(--tok-decl); font-weight: 560; }

/* -------------------------------------------------------------- tables */

.table { overflow-x: auto; margin: 0 0 1.4rem; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td {
  text-align: left; padding: .5rem .7rem;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .1em;
  font-weight: 600; color: var(--ink-faint);
  border-bottom-color: var(--line); white-space: nowrap;
}
td code, th code { white-space: nowrap; }

/* --------------------------------------------------------------- cards */

.cards { display: grid; gap: .7rem; margin: 1.6rem 0 0; }
.card {
  display: block; padding: .9rem 1.1rem;
  border: 1px solid var(--line); border-radius: .5rem;
  color: var(--ink); background: var(--paper-code);
}
.card:hover { border-color: var(--accent); text-decoration: none; }
.card strong { display: block; font-weight: 600; margin-bottom: .1rem; }
.card span { display: block; font-size: .9rem; color: var(--ink-faint); line-height: 1.5; }

/* ------------------------------------------------------------ sequence */

nav.seq {
  display: flex; justify-content: space-between; gap: 1rem;
  max-width: var(--prose);
  margin-top: 3rem; padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}
nav.seq a {
  display: block; max-width: 48%;
  padding: .65rem 1rem;
  border: 1px solid var(--line); border-radius: .5rem;
  color: var(--ink); font-weight: 560;
}
nav.seq a:hover { border-color: var(--accent); text-decoration: none; }
nav.seq a.on { text-align: right; margin-left: auto; }
nav.seq span {
  display: block; font-size: .68rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .16em; color: var(--ink-faint);
  margin-bottom: .1rem;
}

/* --------------------------------------------------------------- front */

.hero { max-width: 46rem; margin: 1.5rem 0 3rem; }
.hero p.lead {
  font-size: 1.25rem; line-height: 1.6; color: var(--ink-soft);
  margin-bottom: 1.6rem;
}
.doors { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .7rem; }

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

footer {
  max-width: calc(var(--prose) + 3rem); margin: 0 auto;
  padding: 2.2rem 1.5rem 3rem;
  border-top: 1px solid var(--line);
  color: var(--ink-faint); font-size: .86rem;
}
footer p { margin: 0; max-width: var(--prose); }
footer a { color: var(--ink-soft); }
footer a:hover { color: var(--ink); }

/* ---------------------------------------------------------- responsive */

/* Below this the centered menu cannot share a row with the wordmark
 * and the tools, so the bar wraps: wordmark and tools first, the menu
 * on its own line, scrolling sideways before it ever collides. */
@media (max-width: 60rem) {
  header.top {
    display: flex; flex-wrap: wrap; align-items: center;
    height: auto; row-gap: .1rem; padding: .6rem 1.25rem;
    position: static;
  }
  nav.tabs { order: 3; width: 100%; justify-content: flex-start; }
  .tools { margin-left: auto; }
}

@media (max-width: 52rem) {
  :root { --bar: 3.25rem; }
  .shell { padding: 0 1rem; }
  main { padding: 1.5rem 0 3rem; }
  h1 { font-size: 2.1rem; }
  h2 { font-size: 1.5rem; margin-top: 2.2rem; }
  h3 { font-size: 1.2rem; }
  header.top { padding: .5rem 1rem; }
  nav.seq { flex-direction: column; }
  nav.seq a { max-width: none; }
  nav.seq a.on { text-align: left; }
}

@media print {
  header.top, nav.seq, footer, button.copy { display: none; }
  article { max-width: none; }
}
