/* frontend/terminal/research.css: the /research index (the river design), written by hand; see docs/research-pages/README.md. */
/* Zena research, the index: the river full-screen with "Zena Research" as its one statement, then the centre, a grid of
   tiles a reader simply scrolls through, reached by the opening's one control, the way down. Each tile is a window onto
   the river (research-river.js draws it into canvas.river) holding one or two facts from the piece, with the kind, date and reading time, the title and the finding
   under it in plain ink on the ground. The two inks are the site's own (zena-tokens.css, dark): cream on warm charcoal,
   and the sunk tone inside a window. Dark only for now. */

:root{
  color-scheme:dark;
  --z-title:#f2efe7;
  --z-surface:#1d1c1a;
  --z-sunk:#171614;
  --sans:-apple-system,BlinkMacSystemFont,"Segoe UI",Inter,Roboto,Helvetica,Arial,sans-serif;
  --head:64px;
  --logo:28px;
  --gutter:56px;
  --statement:232px;
  --statement-two:232px;
  --wipe:700ms;
  --wipe-ease:cubic-bezier(.7,0,.2,1);
}
/* One composition, sized by the window and never in steps. The statement has two arrangements, each one continuous
   formula: on one line it is as large as fits the width inside the gutters and at most a quarter of the height; on two
   lines (a tall, narrow window: "Zena" over "Research") as large as fits the width for the longer word and at most a
   fifth of the height a line. The switch (10/7) is the aspect ratio at which the two come out the same size ("Zena
   Research" is 6.28em wide in the stack's bold at this tracking and "Research" 3.99em; the divisors leave air), so
   dragging the window changes everything together and nothing jumps. The tiles' type follows the window the same way. */
:root{
  --gutter:clamp(16px,3.9vw,56px);
  --statement:min(calc((100vw - 2 * var(--gutter)) / 6.6),25vh,400px);
  --statement-two:min(calc((100vw - 2 * var(--gutter)) / 4.25),20vh,400px);
  --peek:clamp(64px,14vh,170px);
  --tile-gap:clamp(20px,3.4vw,56px);
  --row-gap:clamp(48px,6vw,104px);
  --tile-title:clamp(19px,calc(15.5px + .6vw),27px);
  --tile-text:clamp(15px,calc(13.6px + .3vw),18px);
  --tile-meta:clamp(13px,calc(12.2px + .16vw),15px);
}
@supports (height:1svh){:root{--statement:min(calc((100vw - 2 * var(--gutter)) / 6.6),25svh,400px);--statement-two:min(calc((100vw - 2 * var(--gutter)) / 4.25),20svh,400px);--peek:clamp(64px,14svh,170px)}}
@media (max-width:979px){:root{--head:60px;--logo:24px}}

*,*::before,*::after{box-sizing:border-box}
html,body{margin:0;background:var(--z-surface);color:var(--z-title)}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{
  font-family:var(--sans);font-weight:400;font-size:16px;line-height:1.4;
  -webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-kerning:normal;
  overflow-x:clip;
}
h1,h2,p,ol{margin:0;font:inherit}
a{color:var(--z-title)}
a:focus-visible{outline:2px solid var(--z-title);outline-offset:3px;border-radius:2px}

/* The river: fixed, filling the window, behind everything. Without the engine it is an empty, transparent canvas. */
.river{position:fixed;inset:0;width:100%;height:100%;display:block;z-index:0;pointer-events:none}
.top,main,.foot{position:relative;z-index:1}

/* Header: sits on the ground at the top of the page and scrolls away with it, so it never lies over a tile's words. No bar,
   no hairline. */
.top{
  position:absolute;top:0;left:0;right:0;z-index:2;height:var(--head);
  display:flex;align-items:center;gap:24px;padding:0 var(--gutter);
}
.brand{display:flex;align-items:center;min-height:40px;flex:none}
.brand img{display:block;height:var(--logo);width:auto}
.top-links{display:flex;align-items:center;gap:24px;margin-left:auto}
.top-links a{display:inline-flex;align-items:center;min-height:36px;font-size:16px;line-height:1.4;text-decoration:none;white-space:nowrap}
.top-links a[aria-current=page],.top-links a:hover,.top-links a:focus-visible{text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:6px}

/* The opening: the two words and the way down under them, optically centred in the window together. It stops short of the window's foot by
   --peek, so the first row of windows shows there: a sign that there is more. */
.open{
  min-height:calc(100vh - var(--peek));min-height:calc(100svh - var(--peek));
  display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:.8fr auto auto 1fr;
  padding:var(--head) var(--gutter) 0;
  text-align:center;
}
.statement{
  grid-row:2;justify-self:center;
  font-size:var(--statement);font-weight:400;letter-spacing:-0.034em;line-height:.95;
  white-space:nowrap;color:var(--z-title);
  padding-left:.034em; /* the tracking after the last letter would pull it off centre: give it back on the left */
}
/* the name is set in one weight, the regular one (Palash, 2026-11-22: "unbold the Zena part ... That's really weird
   looking"): neither word is heavy */
/* a tall, narrow window: "Zena" over "Research", each line its own width, so the break falls between the words */
@media (max-aspect-ratio:10/7){.statement{font-size:var(--statement-two);white-space:normal;width:min-content}}

/* The arrival: a hard-edged wipe from upstream (the left), once. Only with JavaScript on and motion allowed; otherwise
   the words are simply there. Nothing changes size or place. */
@media (prefers-reduced-motion:no-preference){
  html.js .statement{
    clip-path:inset(-.12em calc(100% + .12em) -.12em -.12em);
    transition:clip-path var(--wipe) var(--wipe-ease);
  }
  html.js .screen.in .statement{clip-path:inset(-.12em -.12em -.12em -.12em)}
}

/* The way down: the opening's one control, directly under the two words, so the pair sits in the middle of the first
   view (Palash, 2026-11-22: "a little bit more up, like centered around like the initial view"). It is the page's one filled
   thing, a pill in the title ink with the ground as its words (the reverse of everything else), and a plain anchor to the
   centre, so it works with no script. The opening's middle row gives way first on a short window, then the opening grows
   past the window's foot: the peek of windows goes before the button or the statement is ever touched. Its arrow rides
   a few pixels on a slow loop (a translation only, and none under less motion); on hover it sits a little lower (the
   separate translate property, so the two never fight); nothing changes size. */
.way{
  grid-row:3;justify-self:center;
  margin:clamp(28px,6vh,64px) 0 0;
  display:inline-flex;align-items:center;justify-content:center;gap:12px;
  min-height:48px;max-width:100%;padding:8px 22px 8px 26px;border-radius:999px;
  background:var(--z-title);color:var(--z-surface);
  font-size:clamp(15px,calc(13.5px + .3vw),17px);font-weight:600;line-height:1.25;letter-spacing:-0.005em;
  text-decoration:none;text-wrap:balance;
}
.way:focus-visible{outline:2px solid var(--z-title);outline-offset:4px;border-radius:999px}
.way-arrow{position:relative;flex:none;width:12px;height:16px}
.way-arrow::before{content:"";position:absolute;left:5px;top:0;width:2px;height:14px;background:currentColor}
.way-arrow::after{content:"";position:absolute;left:2px;bottom:3px;width:8px;height:8px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(45deg)}
.way:hover .way-arrow{translate:0 3px}
@media (prefers-reduced-motion:no-preference){
  html{scroll-behavior:smooth}
  .way-arrow{animation:way-ride 2.4s ease-in-out infinite}
}
@keyframes way-ride{0%,100%{transform:translateY(-2px)}50%{transform:translateY(2px)}}
.hub{scroll-margin-top:clamp(20px,5vh,56px)}

/* The centre: the tiles, two to a row on a wide window and one on a narrow one (a tile is never narrower than 300px
   unless the window itself is), in a comfortable measure. No arrival: they are simply there, and the river is what moves. */
.hub{padding:0 var(--gutter) clamp(80px,10vw,168px)}
.tiles{
  list-style:none;padding:0;margin:0 auto;max-width:1360px;
  display:grid;gap:var(--row-gap) var(--tile-gap);
  grid-template-columns:repeat(auto-fit,minmax(min(100%,max(300px,calc((100% - var(--tile-gap)) / 2))),1fr));
}
.tile-item{min-width:0}
.tile{position:relative;display:flex;flex-direction:column;min-width:0}

/* A window onto the river: a rounded panel the engine shows the river through, in the piece's own light. With no river
   (no script, no WebGL2, or before it starts) it is the sunk tone, so the page is already finished. */
.win{
  position:relative;aspect-ratio:16/10;border-radius:20px;
  container-type:inline-size;display:grid;place-items:center;overflow:hidden;
}
html:not(.river-on) .win{background:var(--z-sunk)}
/* What a window says: one or two facts, each a figure (heavy, tight, the river parting round it) with the few words that
   say what it is under it (small, regular, the same ink). Everything is sized by the window's own width (container
   units), so the widest pair ("45 to 50¢" beside "29.7%") keeps air round it in every window. Two facts sit side by side
   on a wide window, with air between them and no rule; on a narrow one (by the window's own width, never the page's)
   they stack, each its words on one line where they fit. */
.facts{
  width:100%;padding:0 8cqi;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:max(12px,5cqi);
  text-align:center;
}
.fact{display:grid;justify-items:center;row-gap:1.8cqi;min-width:0;max-width:100%}
.fact-n{
  font-size:10.5cqi;font-weight:700;letter-spacing:-0.042em;line-height:1;white-space:nowrap;
  padding-left:.042em;
}
/* a window that holds only a name (two or three words and no label under it) lets the name break, balanced over its
   lines: "Polymarket's" over "Price History" */
.fact:only-child .fact-n{white-space:normal;text-wrap:balance;line-height:1.04;max-width:84cqi}
.fact-l{font-size:max(12px,3.1cqi);font-weight:400;line-height:1.3;letter-spacing:0;text-wrap:balance;overflow-wrap:break-word}
@container (min-width:340px){
  .facts{flex-direction:row;align-items:flex-start;gap:11cqi}
  .fact:not(:only-child){grid-template-columns:min-content}
}
.vh{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}

/* Under the window, plain ink on the ground, stepping down: the title, the finding, then the small line of kind, date
   and reading time, which is first in reading order. */
.tile-meta{
  margin-top:clamp(16px,1.7vw,24px);
  display:flex;flex-wrap:wrap;gap:0 .5em;
  font-size:var(--tile-meta);line-height:1.5;
}
.tile-meta>:not(:last-child)::after{content:"\00b7";margin-left:.5em} /* a dot after each part, so a wrapped line never starts with one */
.tile-title{
  margin-top:clamp(6px,.6vw,10px);
  font-size:var(--tile-title);font-weight:600;line-height:1.25;letter-spacing:-0.012em;
  text-wrap:balance;overflow-wrap:break-word;
}
.tile-title a{text-decoration:none}
/* the title's link covers the whole tile, so the tile is one link, named by its title */
.tile-title a::after{content:"";position:absolute;inset:0;border-radius:20px}
.tile:hover .tile-title a,.tile-title a:focus-visible{text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:.18em}
.tile-title a:focus-visible{outline:none}
.tile-title a:focus-visible::after{outline:2px solid var(--z-title);outline-offset:8px}
.tile-finding{
  margin-top:clamp(8px,.8vw,12px);max-width:40em;
  font-size:var(--tile-text);font-weight:400;line-height:1.5;text-wrap:pretty;overflow-wrap:break-word;
}

/* Footer: small and plain, after the centre. */
.foot{padding:40px var(--gutter) 48px;text-align:center}
.foot-links{display:flex;flex-wrap:wrap;justify-content:center;gap:8px 24px;font-size:14px;line-height:1.4}
.foot-links a{text-decoration:none}
.foot-links a:hover,.foot-links a:focus-visible{text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:6px}
.legal{max-width:46em;margin:16px auto 0;font-size:13px;line-height:1.5}
.legal + .legal{margin-top:8px}

/* the header in a narrow window, last so it outranks the header rules above */
@media (max-width:359px){.top{gap:12px}.top-links{gap:14px}.top-links a{font-size:15px}}
@media (max-width:299px){.top{gap:8px;padding:0 12px}.brand img{height:20px}.top-links{gap:10px}.top-links a{font-size:14px}}      /* a very narrow pane: the header still fits */
