/* pdai-segment.css — the frame of the segment viewer (segment.html): the page viewer's navbar, a facsimile pane and
   the edition sheet. Colours come from pdai-page.css (Oxford blue chrome, gold accents, warm paper); the edition
   itself is styled by pdai-edition.css (ed-*). Only what the segment frame adds is here. */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body.sg-body { background: var(--paper-sunken); color: var(--ink); font-family: var(--sans); overflow: hidden; }

/* ── navbar (as viewer.html) ─────────────────────────────────────────── */
.sg-navbar { position: fixed; top: 0; left: 0; right: 0; height: 48px; background: var(--oxford); display: flex;
  align-items: center; justify-content: space-between; gap: .45rem; padding: 0 .55rem; z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.sg-navbar .navbar-left { display: flex; align-items: center; gap: .5rem; min-width: 0; flex: 1 1 auto; }
.sg-navbar .crumb { display: flex; align-items: center; gap: .32rem; height: 30px; padding: 0 .55rem 0 .65rem;
  background: rgba(0, 0, 0, .22); border-radius: 8px; font-size: .85rem; color: rgba(255, 255, 255, .72); min-width: 0; }
.sg-navbar .crumb-link { color: rgba(255, 255, 255, .82); text-decoration: none; white-space: nowrap; }
.sg-navbar .crumb-link:hover { color: var(--gold); }
.sg-navbar .crumb-sep { color: rgba(255, 255, 255, .35); }
.sg-navbar .doc-name { color: var(--gold); font-weight: 600; white-space: nowrap; }
/* a narrow window: the path gives way (earlier steps shorten to "…"), the tablet's name and the picker keep their
   place — the name no longer runs under the picker */
.sg-navbar .crumb { flex: 0 1 auto; overflow: hidden; }
.sg-navbar .crumb-link { flex: 0 1 auto; min-width: 1.2rem; overflow: hidden; text-overflow: ellipsis; }
.sg-navbar .crumb-sep, .sg-navbar .doc-name, .sg-navbar .sg-picker { flex: 0 0 auto; }
.sg-navbar .nav-controls { display: flex; align-items: center; gap: .35rem; flex: 0 0 auto; }
.sg-navbar .nav-group { display: flex; gap: .25rem; }
.sg-navbar button, .sg-navbar .sg-navlink { padding: .4rem .7rem; border: 1px solid rgba(255, 255, 255, .3); border-radius: 4px;
  background: rgba(255, 255, 255, .1); color: #fff; cursor: pointer; font: 500 .82rem var(--sans); text-decoration: none;
  display: inline-flex; align-items: center; gap: .3rem; }
.sg-navbar button:hover, .sg-navbar .sg-navlink:hover { background: rgba(255, 255, 255, .2); }
.sg-navbar button:disabled { opacity: .35; cursor: default; }
.sg-navbar .pagination-control { display: flex; align-items: center; background: rgba(0, 0, 0, .25); border-radius: 8px;
  overflow: hidden; height: 36px; }
.sg-navbar .pagination-control button { border: 0; background: transparent; border-radius: 0; height: 100%; padding: 0 .65rem; }
.sg-navbar .page-display { display: flex; align-items: center; height: 100%; padding: 0 .5rem; background: rgba(255, 255, 255, .1);
  border-left: 1px solid rgba(255, 255, 255, .1); border-right: 1px solid rgba(255, 255, 255, .1);
  font: 500 .9rem var(--mono); color: #fff; gap: .2rem; }
.sg-navbar .page-separator { color: rgba(255, 255, 255, .4); }
.sg-navbar .total-pages { color: rgba(255, 255, 255, .7); }
.sg-folio { color: rgba(255, 255, 255, .78); font-size: .8rem; white-space: nowrap; min-width: 7.5em; }
.sg-panelbtns { display: flex; gap: .25rem; }
.sg-panelbtns:empty { display: none; }
.layout-cycle { min-width: 6.2em; justify-content: center; }

/* picker */
.sg-picker { position: relative; }
.sg-picker input { width: 13rem; height: 30px; padding: 0 .6rem; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .1); color: #fff; font: .85rem var(--sans); }
.sg-picker input::placeholder { color: rgba(255, 255, 255, .55); }
.sg-picker input:focus { outline: 2px solid var(--gold); background: var(--paper-sheet); color: var(--ink); }
.sg-picker-list { position: absolute; top: 36px; left: 0; width: 24rem; max-height: 70vh; overflow-y: auto; background: var(--paper-sheet);
  border: 1px solid var(--rule); border-radius: 6px; box-shadow: 0 12px 32px rgba(0, 33, 71, .18); z-index: 1100; }
.sg-pick { display: grid; grid-template-columns: auto 1fr; gap: 0 .6rem; width: 100%; text-align: left; padding: .45rem .7rem;
  border: 0; border-bottom: 1px solid var(--rule); background: transparent; cursor: pointer; color: var(--ink); font: .85rem var(--sans); }
.sg-pick:hover { background: var(--gold-pale); }
.sg-pick b { font-family: var(--serif); color: var(--oxford); }
.sg-pick span { color: var(--ink-muted); font-size: .8rem; }
.sg-pick small { grid-column: 1 / -1; color: var(--ink-faint); font-size: .74rem; }

/* ── panes ───────────────────────────────────────────────────────────── */
.sg-view { position: fixed; top: 48px; left: 0; right: 0; bottom: 0; display: flex; }
body.sg-nobar .sg-navbar { display: none; }
body.sg-nobar .sg-view { top: 0; }
.sg-facs { flex: 0 0 40%; display: flex; flex-direction: column; background: #e9e4d8; border-right: 1px solid var(--rule); min-width: 0; }
.sg-textpanel { flex: 1 1 auto; overflow-y: auto; padding: 22px 28px 80px; min-width: 0; }
.sg-view[data-layout="facsimile"] .sg-textpanel { display: none; }
.sg-view[data-layout="facsimile"] .sg-facs { flex: 1 1 auto !important; }
.sg-view:not([data-layout="both"]) .sg-split { display: none; }
/* the split between facsimile and text */
.sg-split { flex: 0 0 7px; cursor: col-resize; background: var(--rule); position: relative; }
.sg-split::after { content: ""; position: absolute; left: 2px; top: 50%; width: 3px; height: 38px; margin-top: -19px;
  border-left: 1px solid var(--ink-faint); border-right: 1px solid var(--ink-faint); opacity: .6; }
.sg-split:hover, .sg-split:focus-visible { background: var(--gold-border, #d9c47a); outline: none; }
/* facsimile size: whole page, page width, zoom */
.sg-fit { display: flex; gap: 4px; align-items: center; padding: 4px 8px; background: var(--paper); border-bottom: 1px solid var(--rule); }
.sg-fit button { font: 600 .74rem var(--sans); padding: 3px 9px; border-radius: 4px; border: 1px solid var(--rule);
  background: var(--paper-sheet); color: var(--oxford); cursor: pointer; }
.sg-fit button.on { background: var(--oxford); color: #fff; border-color: var(--oxford); }
.sg-zoomlabel { font: .72rem var(--sans); color: var(--ink-faint); margin-left: 6px; }
.sg-view[data-layout="transcription"] .sg-facs { display: none; }
#bd-column:not([hidden]) { flex: 0 0 360px; overflow-y: auto; border-left: 1px solid var(--rule); background: var(--paper); }

.sg-leaves { display: flex; gap: 4px; flex-wrap: wrap; padding: 6px 8px; background: var(--paper); border-bottom: 1px solid var(--rule); }
.sg-leaf { display: flex; flex-direction: column; align-items: center; line-height: 1.1; padding: 3px 9px; border: 1px solid var(--rule);
  border-radius: 4px; background: var(--paper-sheet); color: var(--oxford); font: 600 .78rem var(--serif); cursor: pointer; }
.sg-leaf small { font: .66rem var(--sans); color: var(--ink-faint); }
.sg-leaf:hover { border-color: var(--gold-border); }
.sg-leaf.on { background: var(--oxford); color: #fff; border-color: var(--oxford); }
.sg-leaf.on small { color: #cfd9e8; }
.sg-leaf-plate { border-style: dashed; }
/* a block that scrolls from its top left corner: centred while the page is narrower than the pane, never cut */
.sg-image { flex: 1 1 auto; overflow: auto; display: block; text-align: center; padding: 10px; min-height: 0; }
.sg-image img { display: inline-block; max-width: none; height: auto; vertical-align: top;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .18); background: #fff; }
.sg-loading, .sg-error { padding: 40px; color: var(--ink-muted); font-family: var(--serif); }
.sg-error { color: #8a3b1e; }

/* ── the edition sheet ───────────────────────────────────────────────── */
.sg-sheet { max-width: 1600px; margin: 0 auto; background: var(--paper-sheet); padding: 26px 36px 34px; border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 10px 30px rgba(0, 33, 71, .06); }
.sg-year { text-align: center; font: italic 14px var(--serif); color: var(--ink-muted); margin: -4px 0 6px; }
.sg-bibl { font: .86em var(--serif); color: var(--ink-muted); margin-top: .45em; }
.sg-colhead { display: grid; grid-template-columns: var(--ed-gutter, 2.6em) minmax(0, 1.15fr) minmax(0, 1fr); gap: 0 20px; font: 700 10px var(--sans);
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); margin: 14px 0 0; }
.pdai-page-structured .sg-line { display: grid; grid-template-columns: var(--ed-gutter, 2.6em) minmax(0, 1.15fr) minmax(0, 1fr); gap: 0 20px;
  padding: 3px 0; border-radius: 2px; align-items: baseline; }
.pdai-page-structured .sg-line:nth-of-type(even) { background: rgba(200, 162, 42, .04); }
.pdai-page-structured .sg-line .ed-ln { font: .82em var(--serif); color: var(--ink-faint); text-align: right; padding-right: .3em;
  font-variant-numeric: tabular-nums; }
.sg-wit { color: var(--oxford); font-weight: 700; margin-right: .08em; }
.sg-tl { font-family: var(--serif); line-height: 1.5; overflow-wrap: anywhere; }
.sg-tr { font-family: var(--serif); line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.sg-tl i, .sg-tr i { font-style: italic; }
.ed-det { font-size: .68em; line-height: 0; vertical-align: .55em; }
.sg-dup .ed-ln::after { content: "²"; color: #a1532f; }
.sg-lnote { grid-column: 2 / -1; font: .85em var(--serif); color: var(--ink-muted); }
.sg-surface { margin-top: 1.3em; }
.sg-column { font: 600 11px var(--sans); color: var(--oxford-soft, var(--oxford)); margin: 10px 0 2px var(--ed-gutter, 2.6em);
  letter-spacing: .06em; }
.sg-kind { margin: 8px 0 1px var(--ed-gutter, 2.6em); font: 600 10px var(--sans); letter-spacing: .1em; text-transform: uppercase;
  color: var(--gold); }
.sg-page-mark { display: block; text-align: right; font: 11px var(--sans); color: var(--gold); text-decoration: none;
  margin: 8px 0 2px; border-top: 1px dotted var(--rule-gold); padding-top: 2px; }
.sg-page-mark:hover { color: var(--oxford); }
.sg-cchip { display: inline-block; margin-left: 5px; min-width: 1.4em; text-align: center; font: 600 10px var(--sans); color: #fff;
  background: var(--oxford); border-radius: 8px; padding: 0 5px; vertical-align: .2em; text-decoration: none; }
.sg-cchip:hover { background: var(--gold); color: var(--oxford); }
.sg-flash { animation: sgflash 1.6s ease; }
@keyframes sgflash { 0% { background: #f4e2a6; } 100% { background: transparent; } }
.sg-h2 { font: 700 11px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--oxford); margin: 22px 0 6px;
  padding-bottom: 3px; border-bottom: 1px solid var(--rule); }
.sg-comment { display: grid; grid-template-columns: 6.5em 1fr; gap: 0 10px; padding: 3px 0; font-family: var(--serif); line-height: 1.5; }
.sg-comment .ed-anchor { font: .82em var(--sans); color: var(--ink-muted); text-decoration: none; }
.sg-comment .ed-anchor b { color: #fff; background: var(--oxford); border-radius: 8px; padding: 0 5px; margin-right: 4px; font-size: .9em; }
.sg-table { border-collapse: collapse; font: 13.5px var(--serif); }
.sg-table th { font: 600 10.5px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint);
  text-align: left; padding: 2px 16px 2px 0; }
.sg-table td { padding: 2px 16px 2px 0; border-top: 1px solid var(--rule); }
.sg-unparsed td { color: #8a5a2b; }
/* the plate links in a tablet's head: the text colour of their surroundings (the browser's link blue is unreadable
   on the dark sheet), marked as links by the gold underline */
.sg-plate-link { color: inherit; text-decoration: underline; text-decoration-color: var(--gold, #c8a22a); text-underline-offset: 2px; }
.sg-plate-link:hover, .sg-plate-link:focus-visible { color: var(--gold, #c8a22a); }
.sg-plate-strip { display: flex; gap: 10px; flex-wrap: wrap; }
.sg-plate { width: 120px; display: flex; flex-direction: column; align-items: center; gap: 4px; font: 11px var(--sans);
  color: var(--oxford); text-decoration: none; text-align: center; }
.sg-plate img { width: 120px; height: 150px; object-fit: cover; border: 1px solid var(--rule); background: #fff; }
.sg-quality { margin-top: 22px; font-size: 12px; color: #8a5a2b; background: var(--gold-pale); padding: 7px 11px; border-radius: 4px; }
.sg-status { font-weight: 700; }
.sg-fr { font: 11px var(--mono); color: var(--ink-faint); margin-top: 4px; }

.sg-hint { position: fixed; bottom: 1rem; right: 1rem; background: rgba(0, 0, 0, .8); color: #fff; padding: .5rem .75rem;
  border-radius: 4px; font-size: .75rem; opacity: .7; z-index: 100; }

@media (max-width: 900px) {
  .sg-view { flex-direction: column; }
  .sg-facs { flex: 0 0 40%; border-right: 0; border-bottom: 1px solid var(--rule); }
  .sg-picker input { width: 8rem; }
  .sg-folio, .sg-hint { display: none; }
  .pdai-page-structured .sg-line, .sg-colhead { grid-template-columns: 2.4em 1fr; }
  .sg-tr { grid-column: 2; color: var(--ink-muted); }
  .sg-sheet { padding: 16px; }
}
@media (prefers-color-scheme: dark) {
  body.sg-body { background: #101216; }
  .sg-facs { background: #15171c; }
}

/* overrides of the page sheet's generic headings and tables */
.sg-sheet .ed-tablet-no { text-transform: none; letter-spacing: .01em; font-size: 1.55em; }
.sg-sheet h2.sg-h2 { text-align: left; font-size: 11px; }
.sg-sheet .sg-h3 { font: 600 italic 14px var(--serif); color: var(--oxford); margin: 12px 0 4px; }
.sg-sheet .ed-witnesses { width: auto; border: 0; box-shadow: none; background: transparent; margin: 0 0 .4em; }
.sg-sheet .ed-witnesses td, .sg-sheet .ed-witnesses th { border: 0 !important; background: transparent !important; padding: 0 1em 0 0; }
.sg-sheet .ed-museum { font-family: var(--serif); color: var(--ink); }
.sg-sheet .sg-line .ed-ln { color: var(--ink-faint) !important; }
.sg-comment .ed-anchor.sg-general { visibility: visible; }
body.sg-hint-off .sg-hint { opacity: 0; pointer-events: none; transition: opacity .8s; }
.sg-witnesses { display: grid; grid-template-columns: auto auto 1fr; gap: 1px 12px; margin: 0 0 .45em; font-family: var(--serif); }
.sg-witness { display: contents; }
.sg-witness .ed-siglum { font-weight: 700; color: var(--oxford); }

/* the translation column in German (Famulus translation of the editors' English) */
.sg-lang { min-width: 3.2em; justify-content: center; font-weight: 600 !important; }
.sg-lang-note { font: .78rem var(--sans); color: var(--ink-soft, #6b6457); background: var(--gold-pale, #f6efd9);
  border-left: 3px solid var(--gold, #c8a22a); padding: 5px 10px; margin: 0 0 8px; border-radius: 3px; }
.sg-tr.sg-de { color: var(--ink); }
.sg-tr.sg-de-offen { text-decoration: underline dotted #b4553c; text-underline-offset: 3px; }
.sg-tr.sg-de-fehlt { opacity: .7; font-style: italic; }

/* a side the edition does not print for this line, and a line joined by the printed sequence */
.sg-leer { color: var(--ink-faint); font: italic .82em var(--sans); }
.sg-line.sg-paired .ed-ln::after { content: "⇄"; font-size: .7em; color: var(--gold, #c8a22a); margin-left: 2px; }
.sg-tl { overflow-wrap: normal; word-break: keep-all; }
