/*
 * pdai-edition.css — edition layout for tablet editions (diaries page.dtd and
 * every collection that uses the same grammar).
 *
 * Rendered by repro-xml.js (ed-* classes). The page reads like the printed
 * edition: a running head, the tablet number as title, one compact head card
 * (witnesses, copy, photo, date, preserved months), surface bands, and lines on
 * a fixed number gutter with hanging continuation lines. Section kinds are a
 * thin rule in the margin, not boxes.
 *
 * Palette from pdai-page.css: Oxford blue chrome, gold accents, warm paper.
 */

.pdai-page-structured {
  --ed-gutter: 2.6em;
  --ed-kind-width: 0px;
}

/* ── running head ─────────────────────────────────────────────────────── */
.pdai-page-structured .ed-running-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--serif);
  font-size: 0.82em;
  font-variant: small-caps;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  border-bottom: 0.5px solid var(--rule);
  padding-bottom: 0.25em;
  margin: 0 0 1.1em;
}
.pdai-page-structured .ed-rh-title { font-style: normal; }
.pdai-page-structured .ed-rh-folio { font-variant-numeric: oldstyle-nums; }

/* ── tablet number ────────────────────────────────────────────────────── */
.pdai-page-structured .ed-tablet-no {
  font-family: var(--serif);
  font-size: 1.35em;
  font-weight: 600;
  color: var(--oxford);
  text-align: center;
  margin: 1.2em 0 0.5em;
  letter-spacing: 0.01em;
}
.pdai-page-structured .ed-partial { color: var(--ink-faint); font-weight: 400; }

/* ── head card: witnesses, facts, months ──────────────────────────────── */
.pdai-page-structured .ed-head {
  margin: 0.4em 0 1.1em;
  padding: 0.55em 0.8em 0.6em;
  background: var(--gold-pale);
  border-left: 3px solid var(--gold);
  border-radius: 2px;
  font-size: 0.9em;
  line-height: 1.45;
}
.pdai-page-structured .ed-head-partial { border-left-style: dashed; }
.pdai-page-structured .ed-witnesses {
  border-collapse: collapse;
  margin: 0 0 0.35em;
  font-family: var(--serif);
}
.pdai-page-structured .ed-witnesses th.ed-siglum {
  font-weight: 700;
  color: var(--oxford);
  padding: 0 0.7em 0 0;
  text-align: left;
  vertical-align: baseline;
}
.pdai-page-structured .ed-witnesses td,
.pdai-page-structured .ed-witnesses th {
  padding: 0 0.9em 0 0;
  vertical-align: baseline;
  background: transparent !important;
  border: 0 !important;
  font-size: 1em;
}
.pdai-page-structured .ed-join { color: var(--ink-muted); }
.pdai-page-structured .ed-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15em 1.3em;
  margin: 0;
}
.pdai-page-structured .ed-facts > div { display: flex; gap: 0.4em; align-items: baseline; }
.pdai-page-structured .ed-facts dt {
  font-family: var(--sans);
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}
.pdai-page-structured .ed-facts dd { margin: 0; font-family: var(--serif); }
.pdai-page-structured .ed-months { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 0.45em; }
.pdai-page-structured .ed-month {
  font-family: var(--serif);
  font-size: 0.85em;
  min-width: 2.1em;
  text-align: center;
  padding: 0 0.3em;
  border: 1px solid var(--gold-border);
  border-radius: 2px;
  background: var(--paper-sheet);
  color: var(--oxford);
}
.pdai-page-structured .ed-month-gap {
  border-style: dashed;
  color: var(--ink-faint);
  background: transparent;
}
.pdai-page-structured .ed-month-note {
  font-size: 0.78em;
  color: var(--ink-faint);
  align-self: center;
  margin-left: 0.4em;
}

/* ── editorial note, surface band, rule ───────────────────────────────── */
.pdai-page-structured .ed-note {
  font-family: var(--serif);
  font-size: 0.92em;
  color: var(--ink-muted);
  margin: 0.4em 0 0.8em;
  text-align: left;
  text-indent: 0;
}
.pdai-page-structured .ed-surface {
  font-family: var(--sans);
  font-size: 0.74em;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--oxford);
  margin: 1.15em 0 0.35em;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--rule);
}
.pdai-page-structured .ed-rule {
  border: 0;
  border-top: 1px solid var(--ink-faint);
  width: 40%;
  margin: 0.45em 0 0.45em var(--ed-gutter);
  opacity: 0.6;
}

/* ── sections: a thin margin rule with the kind ───────────────────────── */
.pdai-page-structured .ed-section { position: relative; margin: 0.2em 0; }
.pdai-page-structured .ed-section[data-kind]:not([data-kind="other"]) {
  border-left: 2px solid var(--rule-gold);
  padding-left: 0.6em;
  margin-left: -0.8em;
}
.pdai-page-structured .ed-kind {
  display: block;
  font-family: var(--sans);
  font-size: 0.64em;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0.5em 0 0.1em;
}

/* ── edition lines: fixed gutter, hanging continuation ────────────────── */
.pdai-page-structured .ed-line {
  display: grid;
  grid-template-columns: var(--ed-gutter) 1fr;
  align-items: baseline;
  margin: 0;
  padding: 0.06em 0;
  line-height: 1.42;
  text-indent: 0;
  text-align: left;
}
.pdai-page-structured .ed-ln {
  font-family: var(--serif);
  font-size: 0.82em;
  color: var(--ink-faint);
  font-variant-numeric: lining-nums tabular-nums;
  text-align: left;
  user-select: none;
  cursor: pointer;
}
.pdai-page-structured .ed-txt {
  display: block;         /* an ordinary inline flow: spaces between words survive */
  white-space: normal;
  padding-left: 0;
}
.pdai-page-structured .ed-cont .ed-txt { padding-left: 1.4em; }
.pdai-page-structured .ed-tl .ed-txt {
  font-family: var(--serif);
  font-size: 0.97em;
  letter-spacing: 0.005em;
}
.pdai-page-structured .ed-tr .ed-txt { font-family: var(--serif); }
.pdai-page-structured .ed-line [data-el="hi"][data-rend="italic"] { font-style: italic; }
.pdai-page-structured .ed-line [data-el="hi"][data-rend="superscript"] {
  vertical-align: 0.42em;
  font-size: 0.68em;
  line-height: 0;
}
.pdai-page-structured .ed-line [data-el="hi"][data-rend="subscript"] {
  vertical-align: -0.2em;
  font-size: 0.68em;
  line-height: 0;
}
.pdai-page-structured .ed-line.active,
.pdai-page-structured .ed-line:hover { background: rgba(200, 162, 42, 0.07); }

/* ── comments keyed to lines ──────────────────────────────────────────── */
.pdai-page-structured .ed-comments {
  margin: 1.2em 0 0.6em;
  padding-top: 0.4em;
  border-top: 1px solid var(--rule);
  font-size: 0.9em;
}
.pdai-page-structured .ed-comments h4 {
  font-family: var(--sans);
  font-size: 0.72em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--oxford);
  margin: 0 0 0.4em;
}
.pdai-page-structured .ed-comment {
  display: grid;
  grid-template-columns: 6.5em 1fr;
  gap: 0 0.6em;
  margin: 0 0 0.3em;
  font-family: var(--serif);
}
.pdai-page-structured .ed-anchor {
  font-family: var(--sans);
  font-size: 0.78em;
  color: var(--oxford);
  white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
  .pdai-page-structured .ed-head { background: rgba(226, 186, 66, 0.08); }
  .pdai-page-structured .ed-month { background: transparent; }
}

/* ── Explication · Himmel (famulus-himmel.js) ─────────────────────────── */
.pdai-page-structured .hm-chip {
  display: inline-block;
  margin-left: 0.45em;
  padding: 0 0.35em;
  font-size: 0.78em;
  line-height: 1.35;
  border: 1px solid var(--gold-border, #d4b85c);
  border-radius: 9px;
  background: var(--gold-pale, #fbf5e6);
  color: var(--oxford, #002147);
  cursor: pointer;
  vertical-align: 0.1em;
}
.pdai-page-structured .hm-chip:hover { background: var(--gold, #c8a22a); color: #fff; }
.pdai-page-structured .hm-chip-warn { border-color: #b4553c; }
.fm-himmel .hm-kopf { display: grid; gap: 2px; }
.fm-himmel .hm-tafel { font-family: var(--serif, Georgia, serif); font-size: 1.15em; font-weight: 600; color: var(--oxford, #002147); }
.fm-himmel .hm-datierung { font-size: 0.9em; }
.fm-himmel .hm-liste { list-style: none; margin: 0; padding: 0; }
.fm-himmel .hm-obs { padding: 6px 8px; border-bottom: 1px solid var(--rule, #e0d8c4); cursor: pointer; }
.fm-himmel .hm-obs:hover { background: var(--gold-pale, #fbf5e6); }
.fm-himmel .hm-intervall { cursor: default; opacity: 0.8; }
.fm-himmel .hm-zitat { font-family: var(--serif, Georgia, serif); font-size: 0.92em; }
.fm-himmel .hm-wert { font-size: 0.8em; color: var(--ink-muted, #4a4a6a); margin-top: 2px; }
.fm-himmel .hm-karte svg { width: 100%; height: auto; display: block; margin: 8px 0; border: 1px solid var(--rule, #e0d8c4); }
.fm-himmel .hm-werte { width: 100%; border-collapse: collapse; font-size: 0.84em; }
.fm-himmel .hm-werte th { text-align: left; vertical-align: top; color: var(--ink-faint, #7a7a9a); font-weight: 500; padding: 3px 8px 3px 0; white-space: nowrap; }
.fm-himmel .hm-werte td { padding: 3px 0; }
