/* =============================================================================
   library.css — the library and its two collections: library.html,
   molecules.html, proteins/index.html.

   lessons.html's bar, head and footer, with a catalogue card of its own: the
   same brand, and a card that says what a part is rather than inviting you
   into a lesson. The pages are NOT body.kodo: the bar and foot are their own,
   and lib/site.js only paints the account in. kodo.css stays linked before
   this for the pills, segmented control and tokens their modals use.
   ========================================================================== */
:root {
  --paper: var(--brand-paper); --paper-t: var(--brand-paper-t); --paper-2: var(--brand-paper-2);
  --ink: var(--brand-ink); --ink-t: var(--brand-ink-t); --ink-2: var(--brand-ink-2); --ink-3: var(--brand-ink-3);
  --mute: var(--brand-mute); --deep: var(--brand-green);
  --green: var(--hue-green); --coral: var(--hue-coral); --blue: var(--hue-blue);
  --amber: var(--hue-amber); --violet: var(--hue-violet);
  --serif: 'Literata', Georgia, serif;
  --sans: 'Jost', -apple-system, 'Segoe UI', sans-serif;
  --display: 'Futura', 'Jost', -apple-system, sans-serif;
  --soft: cubic-bezier(0.22, 1, 0.36, 1);
  --bar-h: 4.2rem;
}
* { box-sizing: border-box; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
/* kodo.css sets body to 100% tall, which ends the sticky bar's run one screen down. */
html, body { height: auto; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; letter-spacing: -0.015em; margin: 0; }
h1 em, h2 em { font-style: normal; }
.wrap { width: min(1180px, calc(100% - 4rem)); margin-inline: auto; }
.eyebrow { display: block; font: 500 13px/1 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--coral); margin-bottom: .9rem; }

/* ---- the bar: lessons.html's, word for word ------------------------------ */
header.bar { position: sticky; top: 0; z-index: 30; background: rgba(var(--paper-t), .86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid rgba(var(--ink-t), .1); }
header.bar .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 2rem; flex-wrap: wrap; padding: 1rem 0 .9rem; }
header.bar .mk { line-height: 0; text-decoration: none; }
header.bar .mk img { width: 132px; height: auto; display: inline-block; vertical-align: baseline; }
header.bar nav.links { display: flex; flex-wrap: wrap; align-items: baseline; gap: clamp(.9rem, 2.4vw, 1.7rem); }
header.bar a.lnk, header.bar .acct { font: 600 .74rem var(--sans); letter-spacing: .18em; text-transform: uppercase; text-decoration: none; color: var(--mute); }
header.bar a.lnk:hover, header.bar a.acct:hover { color: var(--coral); }
header.bar a.lnk[aria-current="page"], header.bar a.acct[aria-current="page"] { color: var(--ink); }
header.bar .links .signin { padding: .35em .9em; border: 1.5px solid currentColor; border-radius: 999px; }
header.bar .links .rule { width: 1px; height: 1.1rem; align-self: center; background: rgba(var(--ink-t), .18); }
header.bar .links .menu { position: relative; display: inline-block; }
header.bar .links .menu .summary { position: relative; display: inline-block; padding: 0 0 0 2.2rem; margin: 0; border: 0; background: none; cursor: pointer; font: 600 .74rem var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--mute); line-height: inherit; }
header.bar .links .menu .summary:hover, header.bar .links .menu .summary[aria-expanded="true"] { color: var(--ink); }
header.bar .links .avatar { position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 1.7rem; height: 1.7rem; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--deep); color: var(--paper); font-size: .8rem; letter-spacing: 0; }
header.bar .links .avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
header.bar .links .menu .card { position: absolute; right: 0; top: calc(100% + .6rem); z-index: 10; min-width: 15rem; padding: .9rem 1rem; background: var(--paper); border: 1px solid rgba(var(--ink-t), .12); border-radius: 12px; box-shadow: 0 6px 24px -12px rgba(var(--ink-t), .45); display: flex; flex-direction: column; gap: .75rem; font: 400 .9rem var(--sans); color: var(--ink-2); text-transform: none; letter-spacing: 0; transform: none; }
header.bar .links .menu .card[hidden] { display: none; }
header.bar .links .menu .who { margin: 0; display: flex; flex-direction: column; gap: .15rem; line-height: 1.3; }
header.bar .links .menu .who b { color: var(--ink); font-weight: 600; }
header.bar .links .menu .who span { color: var(--mute); font-size: .8rem; overflow-wrap: anywhere; }
header.bar .links .menu .card button { align-self: flex-start; cursor: pointer; padding: .4em 1em; border: 1.5px solid var(--ink); border-radius: 999px; background: transparent; color: var(--ink); font: 600 .8rem var(--sans); }

/* ---- the head -------------------------------------------------------------- */
/* On a collection page the eyebrow is the way back up to the library. */
a.eyebrow { text-decoration: none; }
a.eyebrow:hover { color: var(--ink); }
.head .meta { margin: 1.1rem 0 0; font: 600 11.5px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.head { padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(2rem, 4vw, 3rem); }
.head .wrap { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 3rem; align-items: end; }
.head h1 { font-size: clamp(3rem, 7vw, 5.4rem); line-height: .95; letter-spacing: -.03em; }
.head h1 em { color: var(--coral); }
.head .lede { font-family: var(--serif); font-size: clamp(1.05rem, 1.5vw, 1.25rem); line-height: 1.5; color: var(--ink-2); margin: 0; max-width: 30em; }
.head .lede b { font-weight: 600; color: var(--ink); }
/* The counts are the way in: each one a door to its section. */
.jump { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.5rem 0 0; }
.jump a { display: inline-flex; align-items: center; gap: .5em; font: 600 11.5px var(--sans); letter-spacing: .1em; text-transform: uppercase; text-decoration: none; color: var(--ink-3); border: 1.5px solid rgba(var(--ink-t), .18); border-radius: 999px; padding: .5em .95em; transition: color .15s, border-color .15s; }
.jump a:hover { color: var(--ink); border-color: var(--ink); }
@media (max-width: 800px) { .head .wrap { grid-template-columns: 1fr; gap: 1.5rem; } }

/* ---- a section: a head across the page, then its shelf -------------------
   No rail: lessons.html's spine says "in this order", and a library has none. */
main { padding: 0 0 5rem; }
.unit { padding: 2.6rem 0 3rem; scroll-margin-top: var(--bar-h); }
.uhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; padding-bottom: 1.1rem; margin-bottom: 1.6rem; border-bottom: 1px solid rgba(var(--ink-t), .12); }
.uhead h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); line-height: 1; letter-spacing: -.025em; }
.uhead .why { font-family: var(--serif); font-style: italic; font-size: 1rem; line-height: 1.4; color: var(--ink-3); margin: .6rem 0 0; max-width: 34em; }
/* The way out of a section into the whole collection: lessons.html's ghost
   .cta, filling with ink on hover. The one button a section has. */
.uhead .go { display: inline-flex; align-items: center; gap: .55em; font: 500 14px var(--sans); letter-spacing: .04em; text-decoration: none; white-space: nowrap; color: var(--ink); padding: .7rem 1.25rem; border-radius: 999px; box-shadow: inset 0 0 0 1.5px rgba(var(--ink-t), .35); transition: background .15s, color .15s, box-shadow .15s, transform .15s var(--soft); }
.uhead .go:hover { background: var(--ink); color: var(--paper); box-shadow: inset 0 0 0 1.5px var(--ink); transform: translateY(-1px); }
.uhead .go span { transition: transform .15s var(--soft); }
.uhead .go:hover span { transform: translateX(3px); }

/* Every column count is FIXED, not auto-fill: library.html cuts its two
   shelves to 2 x their columns, and an auto-fill track would land the cut mid-row. */
.grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.prots { gap: 1.1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.mols { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
@media (min-width: 760px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.prots { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid.mols { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid.prots { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .grid.mols { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* ---- a card: a catalogue entry, between lessons.html's and a flat tile ----
   lessons.html's corners, a hairline instead of its deep shadow, and the
   catalogue's text. A lesson card invites you in; this one says what a part is. */
.card { display: flex; flex-direction: column; cursor: pointer; background: #fff; border: 1px solid rgba(var(--ink-t), .1); border-radius: 12px; box-shadow: 0 1px 2px rgba(var(--ink-t), .04); overflow: hidden; color: inherit; text-decoration: none; transition: border-color .2s, transform .3s var(--soft), box-shadow .3s var(--soft); }
.card:hover { border-color: rgba(var(--ink-t), .22); transform: translateY(-3px); box-shadow: 0 16px 34px -18px rgba(var(--ink-t), .3); }
/* A fixed height, not the still's own size: a row sized by its pictures
   reflows as they land. A component still is a 3:2 frame drawn to its
   edges, so it covers; a protein or molecule is drawn on paper with air
   round it, so it is shown whole. */
.stage { position: relative; height: 150px; background: var(--paper) center / contain no-repeat; }
.stage.shot { background-size: cover; }
.grid.prots .stage, .grid.mols .stage { height: 140px; }
.stage > * { position: absolute; inset: 0; display: block; width: 100%; height: 100%; border: 0; }
.body { padding: .95rem 1.05rem 1.05rem; display: flex; flex-direction: column; flex: 1; }
.name { font-family: var(--display); font-size: 1.05rem; font-weight: 500; line-height: 1.12; letter-spacing: -0.02em; margin: 0; }
.blurb { margin: .45rem 0 .7rem; font-size: .82rem; line-height: 1.5; color: var(--mute); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
/* ONE TAG ON EVERY CARD. A component's features, a protein's species and
   method, a molecule's class: words read off the data, so one chip, set as
   words: uppercase signage would make a classification out of "sperm whale". */
.feats, .facts { list-style: none; display: flex; flex-wrap: wrap; gap: .28rem; margin: .1rem 0 0; padding: 0; }
.facts { margin-top: auto; }
.feats li, .fact { font-size: .68rem; line-height: 1.35; color: var(--ink-2); background: var(--paper); border: 1px solid var(--brand-rule); border-radius: 999px; padding: .2rem .55rem; }
.fact.predicted { background: var(--brand-orange); border-color: var(--brand-orange); color: #fff; }
.rung { margin-top: auto; padding-top: .7rem; font-size: .62rem; letter-spacing: .18em; text-transform: uppercase; font-weight: 600; color: var(--mute); }
.does { margin: .4rem 0 0; align-self: flex-start; font-size: .65rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; color: var(--deep); }
.does.carrier { color: var(--brand-orange); }
/* The formula in the UI face, not a mono: C27H33N9O15P2 should read as a formula, not code. */
.formula { margin: .35rem 0 0; font-size: .8rem; color: var(--ink-3); }
/* `auto` only pushes the chips down where the body has room to spare; on a
   molecule's short body the padding is the floor. */
.grid.mols .facts { padding-top: .75rem; }

/* Phones: two narrow columns, so each card keeps its picture, name, blurb and
   one chip; the rest is a tap away on its own page. */
@media (max-width: 560px) {
  .grid, .grid.prots { gap: .7rem; }
  .grid.mols { gap: .5rem; }
  .stage, .grid.prots .stage { height: 116px; }
  .grid.mols .stage { height: 84px; }
  .body { padding: .7rem .75rem .8rem; }
  .name { font-size: .95rem; overflow-wrap: anywhere; }
  .blurb { font-size: .78rem; margin: .35rem 0 .55rem; }
  .feats li:nth-child(n+2), .fact:nth-child(n+2) { display: none; }
  .rung, .does { letter-spacing: .1em; font-size: .58rem; }
  .grid.mols .body { padding: .55rem .55rem .65rem; }
  .grid.mols .name { font-size: .82rem; overflow-wrap: anywhere; }
  .grid.mols .formula { font-size: .72rem; margin-top: .2rem; }
  .grid.mols .facts { padding-top: .45rem; }
  .grid.mols .fact { font-size: .62rem; padding: .15rem .45rem; }
}

footer { padding: 2.5rem 0 3rem; border-top: 1px solid rgba(var(--ink-t), .2); font: 400 13px var(--sans); color: var(--mute); }
footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
footer a { text-decoration: none; }
footer .dots i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-left: 4px; }

@media (prefers-reduced-motion: reduce) { .card { transition: none; } }
