/* src/catalog/library-page/library.css
 *
 * The /library index. Built on src/site/base.css and held to the same
 * direction as the landing page: the page is the chart's own ground, surfaces
 * are told apart by a step in tone (never a line), one radius, the five type
 * steps and no sixth, no shadows at rest. The list is the page.
 */
/* src/site/base.css
 *
 * The foundation for every public-facing page: the reset, the palette, the
 * five type steps and the motion helpers. Nothing here has a look of its own;
 * the look is in landing.css and the component stylesheets next to it.
 *
 * ── Where the values come from ──────────────────────────────────────────────
 *
 * The palette is "Sheet and biro": a white sheet, black ink, one blue for the
 * action, and a pale grey step for tiles. It is NOT decoration. This product's
 * own interface is dark (see tradingview-colors.ts), so the page is kept
 * neutral on purpose and the chart fragments embedded in it supply the colour.
 * A dark page around a dark chart is what made the previous design read as
 * murky: the chart had nothing to sit against.
 *
 * The face is Work Sans, self-hosted below. One family does every job, which
 * is the commonest arrangement on the sites this page was art-directed from.
 *
 * ── The rules this file exists to keep ──────────────────────────────────────
 *
 * No gradients, no shadows on anything at rest, no hairline rules, no violet.
 * Surfaces are separated by a step in tone, never by a line. One radius for
 * the whole page, decided once, here. Five type sizes, no sixth.
 *
 * The one exception is an element marked `data-ui`: that is a real fragment of
 * the product's own interface, and inside it the product's conventions apply
 * (its borders, its small radii, its dark ground). See demo.css.
 */
/* ---------- the face ----------
 * One variable file spans 300-500, so all three weights cost a single request.
 * `swap` because the page is prerendered: the text must be readable before the
 * font lands, and it is — the fallback stack below is metrically close enough
 * that the reflow is small. Licence: public/fonts/Work-Sans-OFL.txt.
 */
@font-face {
  font-family: 'Work Sans';
  font-style: normal;
  font-weight: 300 500;
  font-display: swap;
  src: url('/fonts/work-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Work Sans';
  font-style: normal;
  font-weight: 300 500;
  font-display: swap;
  src: url('/fonts/work-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* ---------- tokens ----------
 * The page is the chart.
 *
 * Every value below is the workspace's own: the ground is the chart's
 * background, the surface is its panel, the ink is its text colour, and the
 * accent is `color.aqua` -- the colour a plotted series actually comes out in.
 * See components/Chart/tradingview-colors.ts and site/demo/script.ts.
 *
 * A white marketing page around a dark product was the obvious art-direction
 * answer and the wrong one: there is no white anywhere in the application, so
 * the first screen promised a different piece of software from the one the
 * button opens.
 *
 * Dark is not a licence for the things that made the previous design bad.
 * There are still no gradients outside the chart canvas, no glass, no shadows
 * at rest, no outlined cards and no violet. Surfaces are told apart by a step
 * in tone, exactly as they are on a light page.
 */
:root {
  --bg: #131722;
  --surface: #1c2030;
  /* One step further up, for a tile that must separate from --surface. */
  --raise: #252a3a;
  --ink: #d9dce3;
  --muted: #9298a6;

  --accent: #00bcd4;
  --accent-ink: #06202a;
  --accent-deep: #00a5bb;

  /* The one light field on the page: the slip in the receipt section. On a
   * dark page a sheet of paper is the strongest contrast available, so it is
   * spent on the one thing that should read as a printed document. */
  --paper: #e9ecf2;
  --paper-ink: #11141c;

  /* The two colours a candle can be. They mark the band states. */
  --up: #26a69a;
  --down: #ef5350;

  --font: 'Work Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* Real code only. The house style bans monospace everywhere else. */
  --font-code: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; /* taste-skill-ignore: real code in <pre><code> only */

  /* Five steps. There is no sixth; a blueprint asking for one maps onto these. */
  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-head: clamp(2rem, 1.3rem + 3.2vw, 4rem);
  --step-display: clamp(2.75rem, 1.1rem + 5.4vw, 5.25rem);

  --margin: clamp(1rem, 2.2vw, 2rem);
  --gutter: clamp(1rem, 2vw, 2rem);
  --section: clamp(5rem, 12vw, 13rem);
  --radius: 0px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);
  --t-press: 140ms;
  --t-hover: 180ms;
  --t-ui: 240ms;
  --t-reveal: 800ms;
}
/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-body);
  font-weight: 400;
  line-height: 1.55;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, figure, blockquote, ul, ol, dl, dd { margin: 0; }
ul[class], ol[class] { padding: 0; list-style: none; }
img, video, svg, canvas { display: block; max-width: 100%; }
img, video { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
:target { scroll-margin-top: 6rem; }
/* Not in the code editor: one ink colour there would wipe out the syntax colours of selected code. */
:not(.cm-editor *)::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
/* ---------- type ----------
 * Display and headings are set light (300). At these sizes a regular weight
 * reads heavy and a light one reads drawn, which is the point of this face.
 */
h1, h2, h3 {
  color: #ffffff;
  font-weight: 300;
  letter-spacing: -0.035em;
  line-height: 1.0;
  text-wrap: balance;
  hyphens: none;
}
.ocv-display { font-size: var(--step-display); line-height: 0.98; letter-spacing: -0.04em; }
.ocv-head { font-size: var(--step-head); line-height: 1.02; letter-spacing: -0.03em; }
.ocv-lead { font-size: var(--step-lead); line-height: 1.35; letter-spacing: -0.015em; max-width: 34ch; }
.ocv-small { font-size: var(--step-small); line-height: 1.45; }
.ocv-muted { color: var(--muted); }
p { max-width: 62ch; text-wrap: pretty; }
p + p { margin-top: 0.9em; }
.ocv-nums { font-variant-numeric: tabular-nums; }
/* ---------- Pine listings ----------
 * Shared, because two places print Pine source: the live fragment (lazy) and
 * the landing page's compile-error fragment (eager). Keeping these here means
 * the eager one is not unstyled until the lazy chunk lands.
 *
 * `.ocv-demo-line` is a block so a listing breaks per line without a <br>.
 */
.ocv-demo-line { display: block; }
.ocv-t-plain   { color: #d1d4dc; }
.ocv-t-comment { color: #8792a3; }
.ocv-t-string  { color: #a3d9a5; }
.ocv-t-number  { color: #f0a868; }
.ocv-t-call    { color: #70a5f5; }
.ocv-t-keyword { color: #c792ea; }
.ocv-t-colour  { color: #4fc3f7; }
/* ---------- layout ---------- */
.ocv-wrap { padding-inline: var(--margin); }
.ocv-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); }
.ocv-section { padding-block: calc(var(--section) / 2); }
.ocv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* ---------- controls ----------
 * One button shape for the whole page: square, flat, one fill. No shadow, no
 * glow, no gradient — the press is the only feedback and it is a transform.
 */
.ocv-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  min-height: 3.25rem;
  padding: 0 1.5rem;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius);
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease;
}
.ocv-button:active { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) {
  .ocv-button:hover { background: var(--accent-deep); }
}
/* Google require their mark on an unmodified white or dark surface, so their
 * button is the one that does not take the accent fill. */
.ocv-button-google { background: var(--raise); color: #ffffff; }
@media (hover: hover) and (pointer: fine) {
  .ocv-button-google:hover { background: #30374a; }
}
.ocv-link {
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.07em;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  transition: text-decoration-color var(--t-hover) ease;
}
@media (hover: hover) and (pointer: fine) {
  .ocv-link:hover { text-decoration-color: currentColor; }
}
/* ---------- motion helpers ----------
 * Content is visible by default and the hidden states only exist when script
 * is running (`html.js`), so a failed bundle never leaves a blank page.
 */
@media (prefers-reduced-motion: no-preference) {
  .js [data-rise] {
    opacity: 0;
    transform: translateY(18px);
    animation: ocv-rise var(--t-reveal) var(--ease-out) forwards;
    animation-delay: calc(var(--i, 0) * 90ms + 120ms);
  }
  .js .ocv-lines [data-line] {
    transform: translateY(105%);
    animation: ocv-line 900ms var(--ease-out) forwards;
    animation-delay: calc(var(--i, 0) * 110ms + 150ms);
  }
  .js [data-reveal] {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 900ms var(--ease-out), transform 1100ms var(--ease-out);
    transition-delay: calc(var(--i, 0) * 110ms);
  }
  .js [data-reveal].is-in { opacity: 1; transform: none; }
}
/* The masked line reveal: each line rises from behind its own baseline. The
 * mask is the overflow of the wrapper; the padding/negative-margin pair keeps
 * descenders from being clipped while it does. */
.ocv-lines [data-line] { display: block; }
.ocv-lines .ocv-line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.1em;
  margin-bottom: -0.1em;
}
@keyframes ocv-rise { to { opacity: 1; transform: none; } }
@keyframes ocv-line { to { transform: none; } }
.zl {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.zl-nav {
  display: flex;
  align-items: center;
  gap: var(--gutter);
  padding: 22px var(--margin);
  font-size: var(--step-small);
}
.zl-wordmark { font-weight: 500; text-decoration: none; letter-spacing: 0.01em; }
.zl-nav-link { text-decoration: none; color: var(--muted); }
.zl-nav-link[aria-current='page'] { color: var(--ink); margin-left: auto; }
.zl-nav-link:hover { color: var(--ink); }
.zl-nav-action { color: var(--accent); }
.zl-nav-action:hover { color: var(--accent-deep); }
.zl-main {
  width: 100%;
  max-width: 60rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 4rem) var(--margin) 3rem;
  flex: 1;
}
.zl-title {
  font-size: var(--step-head);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 0.4em;
}
.zl-lede {
  font-size: var(--step-body);
  color: var(--muted);
  max-width: 38em;
  margin-bottom: 2rem;
}
/* ── Search ─────────────────────────────────────────────────────────── */
.zl-search {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.zl-input,
.zl-select {
  background: var(--surface);
  color: var(--ink);
  border: 0;
  border-radius: var(--radius);
  font-size: var(--step-body);
  padding: 0.8rem 1rem;
  min-height: 48px;
  width: 100%;
  appearance: none;
}
.zl-input::placeholder { color: var(--muted); }
.zl-input:focus-visible,
.zl-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.zl-input::-webkit-search-cancel-button { filter: invert(0.7); }
.zl-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: stretch;
}
.zl-segs {
  display: flex;
  border: 0;
  margin: 0;
  padding: 0;
  background: var(--surface);
  min-width: 0;
}
.zl-seg { position: relative; display: flex; }
.zl-seg input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  /* The label takes the click; the input is there for the keyboard and the form. */
  pointer-events: none;
}
.zl-seg span {
  display: flex;
  align-items: center;
  padding: 0 1rem;
  min-height: 44px;
  font-size: var(--step-small);
  color: var(--muted);
  cursor: pointer;
  transition: background var(--t-hover) var(--ease-soft), color var(--t-hover) var(--ease-soft);
}
.zl-seg input:checked + span { background: var(--raise); color: var(--ink); }
.zl-seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.zl-select {
  width: auto;
  min-height: 44px;
  padding: 0 2.2rem 0 1rem;
  font-size: var(--step-small);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239298a6' stroke-width='1.5'/%3E%3C/svg%3E");
  background-position: calc(100% - 0.9rem) 50%;
  background-repeat: no-repeat;
}
.zl-submit {
  background: var(--accent);
  color: var(--accent-ink);
  font-size: var(--step-small);
  font-weight: 500;
  padding: 0 1.2rem;
  min-height: 44px;
}
/* With the script running, results follow the typing; the button is for the no-JS form. */
.zl-js .zl-submit { display: none; }
.zl-count {
  font-size: var(--step-small);
  color: var(--muted);
  margin-bottom: 0.5rem;
}
/* ── Results ────────────────────────────────────────────────────────── */
.zl-results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.zl-results[aria-busy='true'] { opacity: 0.6; transition: opacity var(--t-ui) var(--ease-soft); }
.zl-row-link {
  display: grid;
  gap: 0.3rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  text-decoration: none;
  transition: background var(--t-hover) var(--ease-soft);
}
.zl-row-link:hover { background: var(--raise); }
.zl-row-link:focus-visible { outline-offset: -2px; }
.zl-row-name {
  font-size: var(--step-body);
  font-weight: 500;
  overflow-wrap: anywhere;
}
.zl-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  font-size: var(--step-small);
  color: var(--muted);
}
.zl-badge { color: var(--ink); }
.zl-badge[data-kind='indicator'] { color: var(--accent); }
.zl-badge[data-kind='strategy'] { color: var(--up); }
.zl-row-desc {
  font-size: var(--step-small);
  color: var(--muted);
}
.zl-empty {
  padding: 2rem 0;
  color: var(--muted);
}
.zl-more {
  display: block;
  width: 100%;
  margin-top: 1rem;
  min-height: 48px;
  background: var(--surface);
  color: var(--ink);
  font-size: var(--step-small);
}
.zl-more[hidden] { display: none; }
.zl-more:hover { background: var(--raise); }
.zl-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  font-size: var(--step-small);
  color: var(--muted);
}
.zl-pager a { color: var(--accent); text-decoration: none; padding: 0.7rem 0; }
.zl-lists { margin-top: 2.5rem; padding: 1.5rem; background: var(--surface); }
.zl-lists-title { margin: 0 0 1rem; font-size: var(--step-small); color: var(--muted); font-weight: 500; }
.zl-lists ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.25rem 1.5rem; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
.zl-lists li { font-size: var(--step-small); color: var(--muted); }
.zl-lists a { color: var(--accent); text-decoration: none; display: inline-block; padding: 0.4rem 0; }
.zl-lists p { margin: 1rem 0 0; font-size: var(--step-small); }
.zl-foot {
  padding: 2rem var(--margin);
  font-size: var(--step-small);
  color: var(--muted);
  text-align: center;
}
.zl-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
@media (min-width: 40em) {
  .zl-search { flex-direction: row; flex-wrap: wrap; }
  .zl-input { flex: 1 1 18rem; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .zl-row-link, .zl-seg span, .zl-results { transition: none; }
}
