/* What every page of the site shares: the palette and type of the film, a sample of code,
   and the bar at the top. The film (film.css) and the pages to read (site.css) both build on this file, and no
   colour or font is named anywhere else. */

:root {
  /* The stage, its light, and the one colour. */
  --dark: #070605;
  --light: #f1e8da;
  --dim: #a89c8c;
  --ember: #ff8648;
  /* From the film's set (js/film/world.js): the floor, and the edge of the slab. */
  --floor: #14110f;
  --rim: #4a3f34;
  /* The light the film writes code in (js/film/type.js): plain text, keywords, strings, comments. */
  --ink: #e6dccd;
  --peak: #fff;
  --amber: #e2b083;
  --quiet: #8b8072;

  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --edge: clamp(1.25rem, 5vw, 5rem);
  /* A thin line between things, and the warm shadow under a window of code. */
  --line: color-mix(in srgb, var(--rim) 55%, transparent);
  --glow: color-mix(in srgb, var(--ember) 16%, transparent);
}

*, *::before, *::after { box-sizing: border-box; }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 4px; border-radius: 2px; }

/* ---------- Code ---------- */

code { font: 0.86em/1.3 var(--mono); }
:not(pre) > code { padding: 0.12em 0.38em; border-radius: 0.3em; background: color-mix(in srgb, var(--light) 9%, transparent); color: var(--light); overflow-wrap: anywhere; }
a > code { text-decoration: inherit; }

/* A sample is a lit window: a dark body, a bar with three marks and the language, and the
   code as light. The <code> scrolls, so the bar and the copy button stay where they are. */
pre { position: relative; padding: 2.5rem 0 0; background: linear-gradient(color-mix(in srgb, var(--light) 5%, var(--dark)), color-mix(in srgb, var(--floor) 60%, var(--dark)) 5rem); border: 1px solid var(--line); border-top-color: color-mix(in srgb, var(--light) 22%, transparent); border-radius: 0.7rem; box-shadow: 0 1.6rem 3.5rem -2.4rem var(--glow), 0 1rem 2rem -1rem var(--dark); font: 0.82rem/1.7 var(--mono); color: var(--ink); tab-size: 4; }
pre::before { content: ""; position: absolute; top: 1rem; left: 1.1rem; width: 2.5rem; height: 0.55rem; background: radial-gradient(circle at 0.275rem 50%, var(--rim) 0.26rem, transparent 0.29rem) 0 0 / 0.95rem 100% repeat-x; }
pre::after { position: absolute; top: 0.72rem; left: 4.6rem; font: 500 0.66rem/1.3 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--quiet); }
pre:has(> .language-rust)::after { content: "Rust"; }
pre:has(> .language-json)::after { content: "JSON"; }
pre:has(> .language-shell)::after { content: "Shell"; }
pre:has(> .language-request)::after { content: "Request"; }
pre:has(> .language-toml)::after { content: "TOML"; }
pre:has(> .language-sql)::after { content: "SQL"; }
pre > code { display: block; overflow-x: auto; padding: 0.2rem 1.25rem 1.15rem; font: inherit; scrollbar-width: thin; scrollbar-color: var(--rim) transparent; }
pre > code:focus-visible { outline-offset: -3px; border-radius: 0 0 0.6rem 0.6rem; }
pre.tall > code { max-height: 33rem; }
/* Code colours: tools/highlight.py for the static samples, js/exhibit/text.js for the live ones. */
.t-k { color: var(--peak); }
.t-s { color: var(--amber); }
.t-c { color: var(--quiet); }
.t-a { color: var(--dim); }
.t-m { color: var(--ember); }

.copy { position: absolute; top: 0.45rem; right: 0.5rem; padding: 0.4rem 0.7rem; font: 500 0.66rem/1.3 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); background: none; border: 1px solid transparent; border-radius: 999px; cursor: pointer; transition: color 0.3s, border-color 0.3s; }
.copy:hover, .copy:focus-visible { color: var(--light); border-color: var(--line); }
.copy.done { color: var(--ember); }

/* ---------- The corner: the bar at the top of every page ---------- */

.corner { position: fixed; z-index: 3; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: baseline; padding: 1.4rem var(--edge); font-size: 0.8rem; letter-spacing: 0.02em; }
.corner a { text-decoration: none; color: var(--dim); transition: color 0.3s; }
.corner a:hover, .corner a[aria-current] { color: var(--light); }
.mark { font-weight: 600; color: var(--light) !important; }
.mark span { font-weight: 400; color: var(--dim); }
.corner nav { display: flex; gap: 1.6rem; }

@media (max-aspect-ratio: 4/5) {
  .corner .mark span { display: none; }
}
