/* tsra.ai's stylesheet: the site's look, served by the server from its image
   (server/pages.go, /assets/site.css, revalidated), for every page it draws.
   The source of truth since 2026-11-29; it was agent/src/html.ts's CSS, inlined
   into every page, so a change to it meant rebuilding every edition.

   The transcript rules near the end (tei-*) are agent/src/tei.ts's
   transcriptCSS("#viewer"), written out: the agent's preview tool renders with
   that function, so a change to one belongs in the other. */
  /* Playfair italic, self-hosted: the site makes no external requests, so a
     Google Fonts <link> is out. swap keeps text visible while it loads. */
  /* Weight 500, and it has to be a REAL 500 cut. The shipped file is a static
     instance, not a variable font, so asking for font-weight: 500 against a
     400 face would make the browser synthesize one — smeared strokes rather
     than Playfair's actual medium, which is drawn, not emboldened. Subset to
     the four glyphs of the wordmark (a, r, s, t): 1.3KB. */
  @font-face { font-family: "Playfair"; src: url("/assets/playfair-italic-500.woff2") format("woff2");
    font-style: italic; font-weight: 500; font-display: swap; }
  /* Design tokens. Every colour and face is declared ONCE here and referenced
     by role; nothing downstream hardcodes a hex or a font stack. Adding a page
     therefore inherits the scheme instead of re-deriving it. */
  :root {
    --ink:        #2d2a26;   /* darkest: bars, body text on paper */
    --paper:      #f5f2ec;   /* light surface: panels, text on ink */
    --rule:       #cfc8bb;   /* borders and separators */
    --muted:      #6b6459;   /* secondary text, apparatus */
    --muted-soft: #8a8175;   /* tertiary: forme work */
    --muted-ink:  #b8b0a4;   /* secondary text ON the dark bar */
    --hover:      #f7f4ee;   /* row hover */
    --link:       #22508f;
    --font-display: "Playfair", Georgia, serif;
    --font-ui: Arial, Helvetica, system-ui, -apple-system, sans-serif;
    --font-text: Georgia, "Times New Roman", serif;  /* edition prose only */
    --shadow: 0 2px 6px rgba(0,0,0,.10);
    /* Entity underlines in the transcript, by TEI element. */
    --ent-person: #9a6;
    --ent-place:  #69a;
    --ent-date:   #a96;
  }

  * { box-sizing: border-box; }
  html { height: 100%; }
  /* dvh, not vh: on mobile 100vh is the LARGEST viewport (chrome ignored) and
     does not reliably recompute on rotation — which is exactly the "doesn't
     resize when I rotate" bug. dvh tracks the live viewport. The flex column
     below means nothing is measured against a hardcoded bar height either, so
     the viewer simply takes whatever is left. */
  body { font: 16px/1.5 var(--font-ui); margin: 0; color: var(--ink);
         min-height: 100dvh; }
  body.zoom { height: 100dvh; display: flex; flex-direction: column;
              overflow: hidden; }
  /* Three columns so the document title is centred on the PAGE, not merely
     after the wordmark — the side columns are equal-width regardless of
     content. */
  /* minmax(0, auto): the centre gives way (its title ellipsized, below) rather
     than run under the search box at the right when the bar is narrow. */
  .bar { display: grid; grid-template-columns: 1fr minmax(0, auto) 1fr; column-gap: 1rem; align-items: center;
         background: var(--ink); color: var(--paper); padding: .45rem .8rem;
         flex: 0 0 auto; position: relative; }
  .bar a { color: var(--paper); text-decoration: none; }
  .wordmark { font-family: var(--font-display); font-style: italic;
    font-weight: 500; font-size: 1.45em; letter-spacing: .04em; justify-self: start; }
  .bar .grow { flex: 1; }
  .bar .mode a { padding: .1rem .55rem; border: 1px solid var(--muted); border-radius: 3px;
                 font-size: .85em; margin-left: .3rem; }
  .bar .mode a.on { background: var(--paper); color: var(--ink); }
  .muted { color: var(--muted); font-size: .85em; }
  .bar .muted { color: var(--muted-ink); }
  /* Document title + disclosure. The panel is absolutely positioned so
     opening it never resizes the viewer (which would make OSD re-home). */
  /* display:flex, not the default block. As a block, the inline-flex summary
     sits on a text baseline and the line box reserves descender space beneath
     it — measurably 5px, which pushed the title and its chevron ~2.6px above
     the bar's centre while the wordmark opposite sat true. A flex container
     has no line box, so the group centres against the bar itself. */
  details.doc { justify-self: center; display: flex; align-items: center; }
  /* The bar's centre title, shared by the index and the viewer so the two
     cannot drift apart. Plain UI font: only the wordmark is Playfair. */
  .bartitle, details.doc > summary { font-family: var(--font-ui); font-size: .95em; }
  .bartitle { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .barlink { justify-self: end; font-size: .9em; color: var(--muted-ink) !important; }
  .barlink:hover { color: var(--paper) !important; text-decoration: underline; }
  /* The .foliomark indicator that used to sit here is gone. It existed only
     because below EC's md breakpoint the single pane's bar had no folio label,
     so the phone could not tell which leaf it was showing — a gap we patched
     from outside because we could not reach into the library. The fork puts the
     label in the narrow toolbar, where it belongs, so duplicating it in our own
     header would just be two names for the same thing. */
  /* On a phone the archive's full title wraps to two lines, shoves the
     wordmark aside, and repeats verbatim the heading immediately below it. It
     is the one piece of the bar that is pure duplication, so it goes — the
     document disclosure (details.doc) is NOT this rule and stays, because
     nothing else on that page names the document. */
  @media (max-width: 700px) { .bartitle { display: none; } }
  details.doc > summary { display: inline-flex; align-items: center; gap: .5rem;
    cursor: pointer; list-style: none; user-select: none; }
  details.doc > summary::-webkit-details-marker { display: none; }
  /* A chevron — two strokes meeting at a point, drawn as the adjacent borders
     of a rotated square. No shaft, no icon library. Centring is the one thing
     a chevron makes fiddly: the glyph's visual mass sits BELOW the square's
     box centre once rotated, so the -60% pulls it back onto the circle's axis
     rather than leaving it low. Open state rotates the whole circle 180deg —
     the circle is symmetric, so one transform inverts the chevron. */
  /* One colour for the ring and the chevron: currentColor inherited the bar's
     paper white while the ring was --muted, so the two read as different
     components of the same mark. Setting color on .chev makes the chevron
     follow the ring by construction, not by a matched pair of literals. */
  .chev { position: relative; display: inline-block;
    width: 1.05rem; height: 1.05rem; color: var(--muted-ink);
    /* Lighter as in less WEIGHT, not a paler colour — the ring and the
       chevron share currentColor on purpose, so thinning the stroke is the
       only way to lift the ring without breaking that. */
    border: 1.25px solid currentColor; border-radius: 50%; flex: 0 0 auto; }
  .chev::after { content: ""; position: absolute;
    left: 50%; top: 50%; width: .3em; height: .3em;
    border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
    transform: translate(-50%, -60%) rotate(45deg); }
  details.doc[open] .chev { transform: rotate(180deg); }
  /* The document picker occupies the bar's centre cell, where the document's
     name used to sit. Styled as text rather than as a form control: it is the
     page's title that happens to be navigable, and a native select's chrome
     (border, grey field, system font) would read as a form on a page that has
     none. The caret is drawn here so there is still a visible affordance. */
  .docpick-wrap { justify-self: center; position: relative; display: inline-flex;
    align-items: center; }
  .docpick { appearance: none; -webkit-appearance: none;
    font-family: var(--font-ui); font-size: .95em; color: inherit;
    background: transparent; border: 0; border-radius: 3px;
    padding: .1rem 1.25rem .1rem .35rem; margin: 0; cursor: pointer;
    max-width: min(60vw, 22rem); text-overflow: ellipsis; }
  .docpick:hover { background: rgba(255,255,255,.08); }
  /* :focus-visible, not :focus — clicking a select would otherwise leave the
     ring behind for as long as the page is open. */
  .docpick:focus-visible { outline: 1.5px solid var(--muted-ink); outline-offset: 1px; }
  /* The options render in the SYSTEM palette, not the bar's: a dark-on-dark
     list is unreadable on most platforms, and the popup is not ours to theme. */
  .docpick option { color: #111; background: #fff; }
  .docpick-wrap::after { content: ""; position: absolute; right: .45rem;
    width: .34em; height: .34em; pointer-events: none;
    border-right: 1.5px solid var(--muted-ink); border-bottom: 1.5px solid var(--muted-ink);
    transform: translateY(-25%) rotate(45deg); }
  /* ⓘ — the document's description, at the right of the bar. A <details>, so
     it opens with no JS and closes on Escape like the disclosure it replaced;
     it reuses .docpanel for the panel itself, which is why the panel's own
     styling needs no duplicate here. */
  details.info { justify-self: end; display: flex; align-items: center; }
  details.info > summary { display: inline-flex; align-items: center;
    cursor: pointer; list-style: none; user-select: none; }
  details.info > summary::-webkit-details-marker { display: none; }
  /* A circled i built from a border and a letter rather than an icon font: one
     glyph, no request, and it inherits the bar's colour like every other mark
     in it. Fixed size with the letter optically centred — a lowercase i sits
     high in its em box, so line-height alone leaves it looking raised. */
  .iglyph { display: inline-flex; align-items: center; justify-content: center;
    width: 1.05rem; height: 1.05rem; box-sizing: border-box;
    border: 1.25px solid currentColor; border-radius: 50%;
    color: var(--muted-ink); font-family: var(--font-ui); font-size: .72rem;
    /* Upright (owner, 2026-08-18). The italic was borrowed from the editorial
       ⓘ convention and is wrong here: the only italic on this site is the
       wordmark, so a slanted letter in the bar reads as a second piece of
       branding rather than as a control. */
    font-weight: 600; line-height: 1; padding-bottom: .04rem; }
  details.info > summary:hover .iglyph { color: var(--paper); }
  details.info[open] .iglyph { color: var(--paper); }
  /* Anchored to the bar, not to the button: the panel is as wide as it needs to
     be and would otherwise hang off the right edge on a phone. */
  details.info .docpanel { max-width: none; }
  .docpanel { position: absolute; left: 0; right: 0; top: 100%; z-index: 20;
    background: var(--paper); color: var(--ink); border-bottom: 1px solid var(--rule);
    padding: .9rem 1.2rem;
    /* Small and soft: a tight blur close to the edge reads as a lifted sheet;
       the previous 18px/.18 spread looked like a drop-shadow effect. */
    box-shadow: var(--shadow);
    max-height: 60vh; overflow-y: auto; }
  /* The panel is UI, not edition text: plain sans, not the Georgia body face. */
  .docpanel { font-family: var(--font-ui); font-size: .92rem; }
  .docpanel h3 { margin: 0 0 .3rem; font-size: .8em; text-transform: uppercase;
    letter-spacing: .08em; color: var(--muted); font-weight: 600; }
  .docpanel p { margin: 0 0 .9rem; }
  .docpanel .eds a { display: inline-block; margin: 0 .9rem .3rem 0; color: var(--link); }
  details.drop, details.sources { position: relative; font-size: .85em; }
  details.drop summary, details.sources summary { cursor: pointer; color: var(--muted-ink);
    list-style: none; user-select: none; }
  details.drop summary:hover, details.sources summary:hover,
  details[open].drop summary, details[open].sources summary { text-decoration: underline; }
  details.drop summary::-webkit-details-marker,
  details.sources summary::-webkit-details-marker { display: none; }
  details.drop div, details.sources div { position: absolute; right: 0; top: 1.6em; background: var(--paper);
    color: var(--ink); border: 1px solid var(--rule); border-radius: 4px; padding: .5rem .8rem;
    max-width: 34rem; min-width: 18rem; z-index: 10; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
  details.sources div { white-space: nowrap; }
  details.drop p { margin: .3rem 0; }
  details.sources a { display: block; color: var(--link); margin: .15rem 0; }
  main { padding: 1rem 1.2rem; max-width: 1400px; margin: 0 auto; }
  /* Full-bleed rows: the negative margin cancels main's padding so each row
     runs edge to edge and its hover and rule span the whole width, while the
     padding moves onto the row itself so the TEXT still lines up with the
     wordmark above it. A row that stops short of the edge reads as a card
     that forgot its border. */
  .doclist { margin: -1rem -1.2rem; }
  .docrow { display: block; padding: .9rem 1.2rem; border-bottom: 1px solid var(--rule);
    color: inherit; text-decoration: none; }
  .docrow:hover { background: var(--hover); }
  .docrow .t { display: block; font-weight: 600; }
  .docrow .meta { font-weight: normal; color: var(--muted); font-size: .85em;
    margin-left: .5rem; }
  .docrow .d { display: block; color: var(--muted); font-size: .9em; margin-top: .15rem; }
  .docrow.off { opacity: .5; }
  /* Above the list: what the reader is looking at, before the things
     themselves — so it is sized as the page's heading, not as fine print. The
     archive leads in ink; the repository follows muted, since one names the
     material and the other only says where it is kept. No padding of its own —
     the rows cancel main's inset with a negative margin, so re-adding it here
     would indent this block past them. */
  .colophon { margin: 0 0 1.4rem; line-height: 1.35; }
  .colophon .archive { display: block; font-size: 1.3rem; }
  .colophon .repo { display: block; font-size: .95rem; color: var(--muted);
    margin-top: .2rem; }
  /* The about page is the only READING page on the site that is not a
     transcription, so it takes the edition's body face rather than the UI one,
     and a measure short enough to read comfortably. */
  .prose { font-family: var(--font-text); max-width: 34rem; line-height: 1.6; }
  .prose h1 { font-family: var(--font-ui); font-size: 1.5rem; margin: 0 0 1.2rem; }
  .prose h2 { font-family: var(--font-ui); font-size: 1rem; text-transform: uppercase;
    letter-spacing: .07em; color: var(--muted); margin: 2.2rem 0 .6rem; }
  .prose p { margin: 0 0 1rem; }
  .prose a { color: var(--link); }
  .prose strong { font-weight: 600; }
  /* Sits below the document list, so it needs the negative margin the rows use
     to cancel main's padding — otherwise it hangs left of everything above it. */
  /* Left, not centred (owner, 2026-08-18). Every other line on this page — the
     wordmark, each document row, the collection title — starts at the same
     left margin, so a centred footer was the one element floating free of that
     column.
     NO padding of its own: the footer is a child of <main>, which already
     supplies that 1.2rem. Adding it here indented the link a second time and
     left it 19px to the right of the rows it is supposed to line up with —
     .doclist needs its own padding only because it cancels main's to go
     full-bleed, which is the opposite situation. */
  .sitefoot { margin: 2.5rem 0 0; font-size: .9em; text-align: left; }
  .sitefoot a { color: var(--muted); text-decoration: none; }
  .sitefoot a:hover { text-decoration: underline; }
  table { border-collapse: collapse; width: 100%; }
  td, th { padding: .45rem .6rem; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
  tr:hover { background: var(--hover); }
  /* flex:1 + min-height:0 — the min-height is what lets a flex child actually
     shrink, and without it the viewer overflows instead of fitting. */
  /* #viewer is a flex child (rotation fix), but EditionCrafter sizes itself
     with a height:100% chain that does not resolve against a flex item — the
     OSD container collapses to zero height and the facsimile never becomes
     visible. position:relative + absolute-fill gives EC's root a DEFINITE
     pixel box to resolve percentages against, while the flex column keeps
     handling rotation. */
  #viewer { flex: 1 1 auto; min-height: 0; position: relative; }
  #viewer > * { position: absolute; inset: 0; }
  /* The book-mode toggle, XML-source toggle and help popper used to be hidden
     here with display:none. They are now simply absent from the forked bundle
     (see vendor/editioncrafter.umd.js) — the difference between a control that
     is invisible and one that does not exist. The LOCK stays (owner,
     2026-08-16): panes start linked, which is the right default, but unlinking
     is a real reading move and nothing else offers it. */
  /* One document per page: the name is the page's own header, so EC's
     "Document 764 /" prefix is noise — show only the folio. The folio stays
     clickable (it opens EC's jump box). Still a trim from out here because it
     is OUR page that supplies the document header; the library is right to
     print it when it does not know that. */
  .folio-path .document-title, .folio-path .document-title + span { display: none !important; }
  /* The folio is the one label that names WHERE YOU ARE, so it sits centred in
     each pane's toolbar rather than trailing the grid button. Absolute against
     the bar, so centring is on the pane's full width and is unaffected by how
     wide the controls on either side happen to be. */
  #viewer #tool-bar-buttons { position: relative; }
  /* Breathing room between the grid button and the page arrows. They are
     different kinds of navigation — leave the folio vs step through it — and
     with the folio label moved to the centre nothing separated them any more.
     :first-of-type, not a gap on the row: .folio-path sits between them in
     source order but is absolutely positioned, so a flex gap would space
     against a box that no longer takes part in the layout. */
  #viewer .toolbar-left .nav-arrow:first-of-type { margin-left: .75rem; }
  /* Mobile lays the bar out in FLOW instead of absolute-centring it. On a
     375px pane, left:50% parked the folio label underneath the layer dropdown
     — which is exactly why the phone showed a grid button, two arrows,
     "Facsimile", and no folio number anywhere. In flow the row reads
     grid | arrows | folio | layer, all vertically centred; EC's own rules mix
     baseline and center alignment across those groups, and that mismatch is
     the crookedness visible on a phone. */
  @media (max-width: 960px) {
    #viewer #tool-bar-buttons { display: flex; align-items: center;
      gap: .4rem; flex-wrap: nowrap; padding: 0 .4rem; }
    #viewer .folio-path { position: static; transform: none; overflow: visible;
      justify-content: flex-start !important; }
    #viewer .folio-path .folioName { font-weight: 600; min-width: 2.5rem; }
    #viewer .toolbar-side, #viewer #doc-type-help { align-items: center !important; }
    #viewer #doc-type-help { margin-left: auto; }
    #viewer .toolbar-left .nav-arrow:first-of-type { margin-left: .25rem; }
  }
  #viewer .folio-path { position: absolute; left: 50%; transform: translateX(-50%);
    justify-content: center !important; overflow: visible; }
  /* Transcript rendering lives in src/tei.ts, shared with the agent's preview
     tool. CETEIcean emits <tei-*> custom elements, which are inline with no
     default styling — so structure has to be declared or everything runs
     together. Shared because a preview that renders differently from the site
     is worse than no preview: it would approve layouts the reader never sees. */
  
  #viewer tei-div { display: block; font-family: var(--font-text); }
  #viewer tei-p { display: block; margin: .7em 0; }
  /* <lb/> is a MILESTONE, not a container: it marks where the scribe's line
     ended and has no content of its own. Rendering it as a block would open a
     paragraph-sized gap, so it breaks the line and occupies no height. The
     manuscript's lineation is data — a reader collating against the facsimile
     needs the edition's lines to be the leaf's lines. */
  #viewer tei-lb { display: block; height: 0; }
  /* break="no" means a WORD continues across the line ending. The break is
     still shown (it happened), but nothing may be inserted into the middle of
     the word — no hyphen of our own invention. */
  #viewer tei-lb[break="no"] { display: block; height: 0; }
  /* @place is DATA the transcription records — honor it instead of stacking
     everything in reading order. Forme work sits where it sits on the leaf
     (top-left stamp left, top-right number right, on one line); marginalia
     floats into the margin it was written in. This is a diplomatic-ish
     rendering, not a facsimile: true positional correspondence needs zones
     (bounding boxes anchored to the image), which alpha deliberately defers. */
  #viewer tei-fw { display: block; font-size: .78em; color: var(--muted-soft);
    letter-spacing: .04em; margin: .15em 0; }
  #viewer tei-fw[place*="left"] { float: left; clear: left; }
  #viewer tei-fw[place*="right"] { float: right; clear: right; }
  #viewer tei-fw[place*="top"] + tei-fw[place*="top"] ~ * { clear: both; }
  #viewer tei-note { display: block; font-size: .85em; color: var(--muted);
    border-left: 2px solid var(--rule); padding-left: .6em; margin: .5em 0; }
  /* Marginalia hangs OUTSIDE the text column, in a gutter of its own.
     A plain float:left is not a margin — it sits INSIDE the content box, so
     every line beside it is shortened and the whole passage appears indented
     around the note. That reads as the text making room for an interruption,
     when the truth is the opposite: the note was written beside a column that
     was already there.
     So the column gets a gutter (padding) and the note is pulled into it by an
     equal negative margin. The float then lies entirely outside the content
     box, no line box is shortened, and the body text does not move at all.

     The gutter is on the LEFT only, and its width comes from the corpus rather
     than from taste: 112 of the 114 marginal notes are place="left-margin" and
     exactly 2 are right. Reserving a right-hand gutter as well cost ~9em of
     column for two notes in the whole edition, and the column is not free —
     narrowing it made the scribe's lines wrap, which destroys the lineation
     that <lb/> exists to preserve. The two right notes float inside the
     column, which is the correct trade at that frequency. */
  /* THE SCRIBE'S LINES ARE NEVER RE-WRAPPED (owner, 2026-08-17).
     Lineation is data: <lb/> marks where the writer's line ended, and a reader
     collating against the facsimile needs the edition's lines to be the leaf's
     lines. A browser reflowing a long line invents a break that is not on the
     leaf and silently contradicts the transcription — so when a line does not
     fit, the pane scrolls sideways instead. Losing sight of the line end is
     recoverable; being shown a false one is not.
     white-space inherits, so this is set once on the column. */
  #viewer .transcriptContent { padding-left: 7em;
    white-space: nowrap; overflow-x: auto; }
  /* Apparatus is NOT the scribe's line and must wrap: a note is set in a 6em
     gutter, and the longest in the corpus is 43 characters. */
  #viewer tei-note { white-space: normal; }
  #viewer tei-note[place*="left"] { float: left; clear: left; width: 6em;
    margin: .2em 0 .2em -7em; border-left: 0; border-right: 2px solid var(--rule);
    padding: 0 .5em 0 0; text-align: right; }
  #viewer tei-note[place*="right"] { float: right; clear: right; width: 6em;
    margin: .2em 0 .2em 1em; border-left: 2px solid var(--rule);
    padding: 0 0 0 .5em; text-align: left; }
  /* No room for a gutter on a phone: the note returns to the flow rather than
     hanging off the edge of the viewport where it cannot be read. */
  @media (max-width: 900px) {
    #viewer .transcriptContent { padding-left: 0; padding-right: 0; }
    #viewer tei-note[place*="left"], #viewer tei-note[place*="right"] {
      float: none; width: auto; margin: .5em 0; text-align: left;
      border-left: 2px solid var(--rule); border-right: 0; padding: 0 0 0 .6em; }
  }
  /* A heading must not wrap around floated forme work. */
  #viewer tei-head { display: block; font-weight: 600; margin: .6em 0 .3em;
    clear: both; }
  #viewer tei-signed { display: block; margin: .8em 0 0 2em; font-style: italic; }
  #viewer tei-hi[rend="superscript"] { vertical-align: super; font-size: .75em; }
  /* Editor-supplied letters in an expanded abbreviation (D<ex>o</ex>n) render
     italic — the standard scholarly convention, so the reader always sees
     which letters the scribe wrote and which the edition supplied. */
  #viewer tei-ex { font-style: italic; opacity: .85; }
  #viewer tei-persname { border-bottom: 1px dotted var(--ent-person); }
  #viewer tei-placename { border-bottom: 1px dotted var(--ent-place); }
  #viewer tei-date { border-bottom: 1px dotted var(--ent-date); }
  /* A dictionary's entries (dictionary.ts). The viewer lays each top-level <div> of a page out as a
     zone of its margin grid (folioLayout.js), keeping only its id (data-entry-id) and @facs
     (data-facs) on a plain <div> around its children: a dictionary's page is a list, so its pane is
     one column in reading order, and an entry is that <div> -- its headword, then what it is in
     each of the dictionary's other languages on a line of its own, named, the Nahuatl in the
     manuscript's red. Clicking an entry's zone on the scan marks its block (selected-zone). */
  #viewer .surface.grid-mode:has([data-facs^="#z"]) { display: block !important; }
  #viewer div[data-entry-id^="e"][data-facs^="#z"] { display: block; margin: 0 0 .3em; padding: .3em .6em;
    border-left: 3px solid var(--rule); font-family: var(--font-text); }
  #viewer tei-form[type="lemma"] { display: block; }
  #viewer tei-form[type="lemma"] tei-orth { font-weight: 600; }
  #viewer tei-cit[type="translation"] { display: block; margin-left: .9em; }
  #viewer tei-cit[type="translation"]::before { display: inline-block; min-width: 6.6em; margin-right: .3em; font-size: .72em;
    font-style: normal; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
  #viewer tei-cit[type="translation"][lang="la"] { font-style: italic; }
  #viewer tei-cit[type="translation"][lang="la"]::before { content: "Latin"; }
  #viewer tei-cit[type="translation"][lang="nah"],
  #viewer tei-cit[type="translation"][lang="nah"] tei-quote { color: var(--dict-red, #9b2c22); font-style: normal; }
  #viewer tei-cit[type="translation"][lang="nah"]::before { content: "Nahuatl"; }

  /* EC toolbar alignment. Its own rules mix align-items: baseline and center
     across the two panes, which is what reads as crooked icons on mobile —
     normalize to center, tighten gaps, and let the bar breathe at narrow
     widths instead of clipping. */
  #viewer .toolbar-side { align-items: center !important; gap: .35rem; }
  #viewer .folio-path { align-items: center !important; }
  /* SCOPED to the toolbar. Unscoped, this rule also hit
     .paginationControl .folioName — EC lays that row out with INLINE-BLOCK
     arrows, so turning the folio label into a flex (block-level) box broke
     the line in two and stacked the arrows vertically with the label adrift.
     That was the "why is this so broken" layout. */
  #viewer .folio-path .folioName { display: flex; align-items: center; min-height: 2rem; }
  /* Hidden at EVERY width now. This row used to be load-bearing on a phone —
     below EC's md breakpoint the single pane had no toolbar arrows and no folio
     label, so it was the only way to change folio or to know which one you were
     on — which is why it could only be hidden on desktop. The fork puts the
     folio name and the arrows in the narrow toolbar, so both widths navigate
     the same way and this second, larger copy is redundant everywhere. It still
     renders in the empty-pane watermark, which is the only place left. */
  #viewer .paginationComponent { display: none !important; }
  @media (max-width: 700px) {
    #viewer .toolbar-side { gap: .2rem; }
    #viewer .toolbar-side svg { width: 1.15rem; height: 1.15rem; }
  }
  /* The right of the bar: the search box, then whatever the page puts there
     (About, the ⓘ). One flex group so the grid's third cell stays one cell and
     the title stays centred on the page. */
  /* grid-column: 3, so it stays at the right when a phone hides the title. */
  .barend { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: .9rem; }
  /* The bar's search box: a plain GET form to /search, so it needs no script
     and works on every page, static or not. Drawn as part of the bar -- a
     faint field on the ink with a magnifier, not a white form control. */
  .barsearch { margin: 0; display: flex; }
  /* Widths in vw as well: the centre cell holds the archive's title, and a
     fixed width would run into it between a phone and a desktop. */
  .barsearch input { font: .9em var(--font-ui); color: var(--paper); width: min(13rem, 18vw);
    appearance: none; -webkit-appearance: none;
    background: rgba(255,255,255,.08) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%23b8b0a4' stroke-width='1.6'%3E%3Ccircle cx='6' cy='6' r='4.5'/%3E%3Cpath d='m9.5 9.5 3.5 3.5'/%3E%3C/svg%3E") no-repeat .5rem 50%;
    border: 1px solid rgba(255,255,255,.14); border-radius: 3px;
    padding: .22rem .5rem .22rem 1.7rem; transition: width .15s, background-color .15s; }
  .barsearch input::placeholder { color: var(--muted-ink); }
  .barsearch input:focus { outline: none; width: min(17rem, 20vw); background-color: rgba(255,255,255,.14);
    border-color: var(--muted-ink); }
  .barsearch input::-webkit-search-cancel-button { display: none; }
  /* On a phone the field is its magnifier until it is tapped. */
  @media (max-width: 700px) {
    /* 16px: iOS zooms the page into any field set smaller. */
    .barsearch input { width: 2rem; padding-right: 0; cursor: pointer; font-size: 16px; }
    .barsearch input::placeholder { color: transparent; }
    .barsearch input:focus { width: 9.5rem; padding-right: .5rem; cursor: text; }
  }
  /* /search (served by the library loop, lab/tsra_web.py, linking this sheet):
     the query, then hits as the document list draws its rows. */
  .search { display: flex; gap: .5rem; max-width: 42rem; margin: .3rem 0 .5rem; }
  .search input { flex: 1; min-width: 0; font: 1.05rem var(--font-ui); color: var(--ink);
    background: #fff; border: 1px solid var(--rule); border-radius: 3px; padding: .5rem .7rem;
    appearance: none; -webkit-appearance: none; }
  .search input:focus { outline: none; border-color: var(--muted); box-shadow: var(--shadow); }
  .search button { font: .95rem var(--font-ui); color: var(--paper); background: var(--ink);
    border: 0; border-radius: 3px; padding: 0 1.1rem; cursor: pointer; }
  .search-hint { margin: 0 0 1.4rem; }
  .hitcount { margin: 0 0 .5rem; }
  .hits { margin: 0 -1.2rem; border-top: 1px solid var(--rule); }
  .hit .x { display: block; font-family: var(--font-text); line-height: 1.55;
    margin-top: .35rem; white-space: pre-line; color: var(--ink); max-width: 46rem; }
  .hit mark { background: #efe2bf; color: inherit; padding: 0 1px; }
  .hit .tag { font-size: .78em; font-weight: normal; color: var(--muted); border: 1px solid var(--rule);
    border-radius: 3px; padding: 0 .35rem; margin-left: .5rem; white-space: nowrap; }
  /* Nothing holds the question's words: said before the nearest-in-meaning
     hits, so they are not read as answers. */
  .notice { margin: 0 0 .8rem; color: var(--muted); font-size: .92em; }
  .notice strong { color: var(--ink); }
  /* How a hit answers: exact (all the words), partial (some), related (only
     near in meaning). A quiet chip after the title, strongest the most coloured. */
  .hit .match { font-size: .75em; font-weight: 600; letter-spacing: .02em; border-radius: 999px;
    padding: .05rem .5rem; margin-left: .55rem; white-space: nowrap; vertical-align: .1em; }
  .hit .match.exact { background: #e3ecd9; color: #3f5a2b; }
  .hit .match.partial { background: #f1e6c8; color: #6b5418; }
  .hit .match.related { background: transparent; color: var(--muted); border: 1px solid var(--rule); font-weight: normal; }
  /* The archives, one click each to keep the search to one (archive:), with how
     many of their passages hold the words and entries the words name. */
  .chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
  .chips a { font-size: .85em; color: var(--ink); text-decoration: none; border: 1px solid var(--rule);
    border-radius: 999px; padding: .2rem .7rem; background: #fff; }
  .chips a:hover { border-color: var(--muted); }
  .chips a.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
  .chips .n { color: var(--muted); margin-left: .25rem; }
  .chips a.on .n { color: var(--muted-ink); }
  /* The dictionary's answer, above the passages: what the word is, before where
     it is used. A panel, so it reads as the answer and not as the first hit. */
  .card { margin: 0 0 1.4rem; border: 1px solid var(--rule); border-radius: 4px; background: var(--hover);
    max-width: 52rem; overflow: hidden; }
  .card h2 { margin: 0; padding: .55rem 1rem .35rem; font-size: .75rem; font-weight: 600; letter-spacing: .08em;
    text-transform: uppercase; color: var(--muted); }
  .card .docrow { padding: .6rem 1rem; border-bottom: 0; border-top: 1px solid var(--rule); }
  .card .docrow:hover { background: #fff; }
  .card .more { margin: 0; padding: .5rem 1rem .6rem; border-top: 1px solid var(--rule); font-size: .9em; }
  .card .more a { color: var(--link); text-decoration: none; }
  .entry .hw { font-family: var(--font-text); font-size: 1.15em; font-weight: 600; }
  .entry .forms { display: block; font-family: var(--font-text); margin-top: .2rem; color: var(--ink); }
  .entry .lang { font-family: var(--font-ui); font-size: .72em; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); margin-right: .15rem; }
  .entry .d { margin-top: .25rem; }
  .entry mark { background: #efe2bf; color: inherit; padding: 0 1px; }
  /* Previous / Page n / Next, under the hits, lined up with them. */
  .pager { display: flex; align-items: center; gap: 1.2rem; margin: 1.2rem 0 0; font-size: .95em; }
  .pager a { color: var(--link); text-decoration: none; }
  .pager a:hover { text-decoration: underline; }
  .htmx-indicator { opacity: 0; transition: opacity .2s; }
  .htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
  #results.htmx-request { opacity: .55; }
  .fnav { display: flex; gap: .15rem; flex-wrap: wrap; }
  .fnav a { padding: 0 .45rem; border: 1px solid var(--muted); border-radius: 3px;
            font-size: .8em; color: var(--paper); }
  .folio { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr);
           gap: .8rem; padding: .6rem .8rem; border-bottom: 2px solid var(--rule);
           scroll-margin-top: 3rem; }
  @media (max-width: 900px) { .folio { grid-template-columns: 1fr; } }
  .folio img { width: 100%; height: auto; }
  .folio h2 { grid-column: 1 / -1; margin: 0; font-size: 1.05em; }
  .folio h2 a { font-size: .75em; font-weight: normal; margin-left: .8rem; }
  tei-div { display: block; }
  tei-p { display: block; margin: .6em 0; }
  tei-head { display: block; font-style: italic; color: var(--muted); margin: .4em 0; }
  tei-signed { display: block; margin: .6em 0 0 2em; }
  tei-note { display: block; font-size: .85em; color: var(--muted); margin: .5em 0; }
