/* Programme renderer: one sheet side = one .sheet, sized in mm incl. 3 mm bleed. */
:root { --scale: 1; --ink: #222; --muted: #555; }

html, body { margin: 0; padding: 0; background: transparent; }
body.preview { background: #e8e5df; padding: 14px; }
body.preview .sheet { box-shadow: 0 3px 14px rgba(0,0,0,.25); margin: 0 auto 18px; }
body.print .sheet { page-break-after: always; }

.sheet {
  position: relative; overflow: hidden; background: #fff; color: var(--ink);
  font-family: 'EB Garamond', 'Garamond', Georgia, serif;
  font-size: calc(9pt * var(--scale)); line-height: 1.32;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.sheet .bg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.sheet .panels { position: absolute; display: flex; }
.panel { position: relative; height: 100%; box-sizing: border-box; overflow: hidden; }
body.preview .panel + .panel { border-left: 1px dashed rgba(0,0,0,.18); }
.bleed-mark { position: absolute; border: 1px solid rgba(214,40,40,.35); pointer-events: none; }
body.print .bleed-mark { display: none; }

/* flow containers */
.flow { position: absolute; inset: 0; padding: 14mm 9mm 10mm; text-align: center; box-sizing: border-box; overflow: hidden; }
.flow.back-flow { position: relative; inset: auto; height: auto; padding-bottom: 4mm; }

.part { text-align: center; }
.part-h { font-size: 1.32em; letter-spacing: .04em; text-transform: uppercase; font-weight: 400;
          margin: 0 0 .25em; padding-top: 1.1em; }
.flow > .part:first-child .part-h, .flow > :first-child.part-h { padding-top: 0; }
.item { margin: 0 0 1.05em; }
.item-t { font-size: 1.12em; }
.item-c { font-style: italic; font-size: .78em; color: var(--muted); margin-top: .1em; }
.item-c.after { margin-top: .35em; }
.verses { text-align: left; margin: .7em auto 0; display: block; }
.verses.c1 { width: max-content; max-width: 100%; }
.verses.c2, .verses.c3 { column-gap: 5mm; column-fill: balance; }
.verses.c2 { columns: 2; max-width: 100mm; margin-left: auto; margin-right: auto; }
.verses.c3 { columns: 3; font-size: .92em; }
.verse { white-space: pre-line; margin: 0 0 .85em; break-inside: avoid; }
.verse:last-child { margin-bottom: 0; }
.verse.refrain { font-style: italic; }
.ftext { white-space: pre-line; }
.ftext.center { text-align: center; }

/* cover */
.cover { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
         text-align: center; padding: 14mm 9mm 11mm; box-sizing: border-box; }
.symbol { height: 15mm; margin-bottom: 6mm; }
.symbol svg { height: 100%; }
.portrait { width: 62mm; height: 80mm; border-radius: 50%; overflow: hidden; background: #e7e7e7;
            margin-bottom: 8mm; display: flex; align-items: center; justify-content: center; color: #aaa; }
.portrait.square { border-radius: 0; width: 70mm; height: 88mm; }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.c-name { font-size: 1.85em; line-height: 1.15; font-weight: 500; }
.c-dates { margin-top: 3mm; font-size: 1.1em; line-height: 1.4; }
.c-cer { margin-top: auto; font-size: 1.1em; line-height: 1.4; }

/* back */
.back { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 9mm 9mm 8mm;
        box-sizing: border-box; text-align: center; }
.back .b-img { width: 100%; flex: 1 1 auto; min-height: 30mm; max-height: 120mm; overflow: hidden; margin-bottom: 6mm; }
.back .b-img img { width: 100%; height: 100%; object-fit: cover; }
.back .b-spacer { flex: 1 1 auto; }
.b-thanks { font-style: italic; white-space: pre-line; margin-bottom: 4mm; }
.b-burial { font-style: italic; margin-bottom: 6mm; }
.b-people { display: grid; grid-template-columns: auto auto; column-gap: 2mm; row-gap: .15em;
            font-size: .82em; margin: 0 auto; text-align: left; }
.b-people .r { text-align: right; color: var(--muted); }
.b-print { font-size: .6em; color: #999; margin-top: 5mm; }

/* photo page */
.photos { position: absolute; inset: 0; padding: 9mm 7mm; box-sizing: border-box; display: grid; gap: 4mm; }
.photos .ph { overflow: hidden; background: #eee; }
.photos .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos.n1 { grid-template: 1fr / 1fr; }
.photos.n2 { grid-template: 1fr 1fr / 1fr; }
.photos.n3 { grid-template: 1fr 1fr 1fr / 1fr; }
.photos.n4 { grid-template: 1fr 1fr / 1fr 1fr; }
.photos.n5 { grid-template: 1fr 1fr 1fr / 1fr 1fr; }
.photos.n5 .ph:first-child { grid-column: 1 / 3; }
.photos.n6 { grid-template: 1fr 1fr 1fr / 1fr 1fr; }
.placeholder { display: flex; align-items: center; justify-content: center; color: #9aa; font-family: sans-serif;
               font-size: 8pt; text-align: center; height: 100%; border: 1px dashed #bbb; }
body.print .placeholder { display: none; }
.overflow-warn { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(200,40,40,.9); color: #fff;
                 font: 8pt sans-serif; text-align: center; padding: 3px; }
body.print .overflow-warn { display: none; }

/* editor preview only */
body.preview .item[data-f] { cursor: pointer; border-radius: 2px; }
body.preview .item[data-f]:hover { outline: 1px solid rgba(47,93,85,.5); outline-offset: 2px; }
body.preview.nomarks .bleed-mark { display: none; }
body.preview.nomarks .panel + .panel { border-left-color: rgba(0,0,0,.07); }

/* symbols, ornaments, frames */
.symbol { height: auto; display: flex; justify-content: center; align-items: flex-end; }
.symbol img { display: block; }
.mask { -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-size: contain; mask-size: contain;
        -webkit-mask-position: center; mask-position: center; }
.orn { display: flex; justify-content: center; margin: .2em auto 1.1em; }
.part-o { padding-top: .9em; margin-bottom: 0; }
.item-orn { margin: .2em 0 1em; }
.frame { position: absolute; inset: 5mm; pointer-events: none; z-index: 2; }
.frame.fr-line { border: .25mm solid #9a9a9a; }
.frame.fr-double { border: .9mm double #555; }
.frame.fr-gold { border: .6mm solid var(--fc); box-shadow: inset 0 0 0 1.1mm #fff, inset 0 0 0 1.4mm var(--fc); }
.panel:has(.frame) .flow { padding-top: 16mm; padding-left: 12mm; padding-right: 12mm; }
.panel:has(.frame) .back { padding: 12mm 12mm 10mm; }
.ph-text { color: #b4bcc6; font-style: italic; }
body.print .ph-text { display: none; }

/* cover variants */
.cv-name_top .symbol { margin-bottom: 5mm; }
.cv-name_top .c-name { font-style: italic; font-size: 2.3em; font-weight: 400; margin-bottom: 7mm; }
.cv-name_top .portrait { width: 48mm; height: 62mm; margin-bottom: 7mm; }
.cv-name_top .c-dates, .cv-name_top .c-cer { font-style: italic; }
.cv-large { padding-top: 0; }
.cv-large .portrait { width: calc(100% + 18mm); height: 64%; margin: 0 -9mm 7mm; border-radius: 0; flex-shrink: 0; }
.cv-large .symbol { margin-bottom: 3mm; }
.cv-large .c-name { font-size: 2.25em; }
.cv-text .symbol { margin-top: 18%; margin-bottom: 12mm; }
.cv-text .c-name { font-size: 2.3em; font-style: italic; font-weight: 400; }
.cv-text .c-dates { margin-top: 5mm; }
.panel:has(.frame) .cv-large .portrait { width: calc(100% + 0mm); margin: 7mm 0 7mm; height: 58%; }

/* thumbnails of layouts */
body.thumb { padding: 0; background: #fff; overflow: hidden; }
body.thumb .sheet { box-shadow: none; margin: 0; }
body.thumb .panel + .panel { border-left: 1px solid rgba(0,0,0,.06); }

/* everything clickable in the editor preview */
body.preview:not(.thumb) [data-e] { cursor: pointer; }
body.preview:not(.thumb) [data-e]:not(.cover):not(.back):not(.flow):not(.photos):hover { outline: 1px solid rgba(47,93,85,.5); outline-offset: 2px; }
body.preview:not(.thumb) .photos:hover { outline: 1px solid rgba(47,93,85,.5); outline-offset: -3px; }

/* ── styles (themes): typeface pairing + colours ─────────────────────────── */
.sheet { --f-body: 'EB Garamond', Georgia, serif; --f-name: var(--f-body); --f-head: var(--f-body); --accent: var(--ink); --soft: var(--muted);
         font-family: var(--f-body); }
.c-name { font-family: var(--f-name); color: var(--accent); }
.part-h { font-family: var(--f-head); }
.panel { container-type: inline-size; }
.portrait { width: 52cqw; height: 67cqw; }
.portrait.square { width: 58cqw; height: 73cqw; }
.cv-name_top .portrait { width: 40cqw; height: 52cqw; }

.th-mildur { --f-body: 'Cormorant Garamond', Georgia, serif; --ink: #3b3331; --muted: #6d625d; --accent: #4e3f38; }
.th-mildur, .th-dokkur { --tsz: 1.07; }
.th-mildur .item-t { font-weight: 500; }
.th-glaesilegur { --f-body: 'EB Garamond', Georgia, serif; --f-name: 'Playfair Display', Georgia, serif; --f-head: 'Playfair Display', Georgia, serif; }
.th-glaesilegur .c-name { font-weight: 400; letter-spacing: .01em; }
.th-glaesilegur .part-h { font-size: 1.1em; letter-spacing: .12em; }
.th-skrift { --f-name: 'Great Vibes', cursive; --accent: #3a3030; }
.th-skrift .c-name { font-size: 3em; font-weight: 400; font-style: normal !important; line-height: 1.1; }
.th-skrift .part-h { letter-spacing: .14em; font-size: 1.15em; }
.th-nutima { --f-body: 'Lato', Arial, sans-serif; --f-name: 'Jost', Arial, sans-serif; --f-head: 'Jost', Arial, sans-serif; --ink: #2b2b2b; --muted: #707070; }
.th-nutima .c-name { font-weight: 300; text-transform: uppercase; letter-spacing: .14em; font-style: normal !important; font-size: 1.7em; }
.th-nutima .c-dates, .th-nutima .c-cer { font-style: normal !important; letter-spacing: .03em; font-size: 1em; }
.th-nutima .part-h { font-weight: 400; letter-spacing: .22em; font-size: 1em; }
.th-nutima .item-t { font-size: 1.02em; }
.th-nutima .item-c, .th-nutima .b-thanks, .th-nutima .b-burial { font-style: normal; }
.th-nutima .verses { font-size: .95em; }
.th-dokkur { --f-body: 'Cormorant Garamond', Georgia, serif; --ink: #2d2a28; --accent: #2d2a28; }
.th-dokkur.sh-out { background: #1d2230; --ink: #e8dcc4; --muted: #c4b38f; --accent: #d7b977; color: var(--ink); }
.th-dokkur.sh-out .portrait { box-shadow: 0 0 0 .5mm #d7b977; background: #2a3042; }
.th-dokkur.sh-out .photos .ph { background: #2a3042; }
.th-dokkur.sh-out .b-people .r { color: var(--muted); }
body.preview .th-dokkur.sh-out .panel + .panel { border-left-color: rgba(255,255,255,.15); }

/* ── covers on a picture ──────────────────────────────────────────────────── */
.panel-bg { position: absolute; top: 0; bottom: 0; background-size: cover; background-position: center; z-index: 0; }
.sheet .panels { z-index: 1; }
.bg-land::after { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(255,255,255,.55), rgba(255,255,255,.15) 45%, rgba(255,255,255,.75)); }
.cv-bg .portrait { box-shadow: 0 0 0 1.4mm #fff, 0 1mm 4mm rgba(0,0,0,.25); }
.cv-bg .c-name { font-size: 2.1em; }
.cv-bg .c-cer { background: rgba(255,255,255,.72); padding: 2mm 4mm; border-radius: 1mm; }
.cv-full { padding: 0; justify-content: flex-end; }
.cv-full .c-band { width: 100%; box-sizing: border-box; padding: 20mm 9mm 11mm; color: #fff;
                   background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.55) 40%, rgba(0,0,0,.7)); }
.cv-full .c-name { color: #fff; font-size: 2.3em; }
.cv-full .c-dates, .cv-full .c-cer { color: rgba(255,255,255,.92); }
.cv-full .c-cer { margin-top: 6mm; }
.cv-full .symbol { margin-bottom: 4mm; }
.c-full-ph { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; color: #9aa; font: 8pt sans-serif;
             border: 1px dashed #bbb; box-sizing: border-box; }
body.print .c-full-ph { display: none; }

/* ── decorations (static/decor, public domain / CC0, see src/CREDITS.md) ─── */
.sheet.paper { background-image: url(/static/decor/pappir.jpg); background-size: 110mm; }
.sheet.paper .panel-bg { background-color: transparent; }
.portrait.sepia img { filter: sepia(.45) contrast(.95) brightness(1.03); }
.pt-wrap { position: relative; margin-bottom: 8mm; flex-shrink: 0; }
.pt-wrap .portrait { margin-bottom: 0; }
.pt-wrap .dec { position: absolute; pointer-events: none; -webkit-mask-size: 100% 100%; mask-size: 100% 100%; }
.dec-wreath .dec { left: -24%; right: -24%; top: 2%; bottom: -13%; z-index: 0; }
.pt-wrap .portrait { position: relative; z-index: 1; }
.dec-wreath .portrait { width: 44cqw; height: 57cqw; }
.dec-oval .dec { left: -19%; right: -19%; top: -15%; bottom: -14%; z-index: 2; }
.dec-oval .portrait { width: 44cqw; height: 58cqw; }
.cover .rose { position: absolute; pointer-events: none; z-index: 0; }
.cover .rose-a { width: 27cqw; top: 2.5mm; right: 2.5mm; transform: rotate(8deg); }
.cover .rose-b { width: 26cqw; bottom: 3mm; left: 2mm; transform: scaleX(-1) rotate(6deg); }
.cover > :not(.rose) { position: relative; z-index: 1; }
.frame.fr-nouveau { inset: 4mm; -webkit-mask-size: 100% 100%; mask-size: 100% 100%; }
.panel:has(.fr-nouveau) .flow { padding-top: 18mm; padding-left: 13mm; padding-right: 13mm; }
.pt-wrap.dec-wreath { margin-bottom: 13mm; margin-top: 2mm; }
.pt-wrap.dec-oval { margin-top: 6mm; margin-bottom: 11mm; }
.panel:has(.fr-nouveau) .cover { padding: 19mm 15mm 17mm; }
.panel:has(.fr-nouveau) .back { padding: 19mm 15mm 16mm; }
