/* ===== Funeral programme designs (screen + print). Sizes use container units so thumbnails, preview and print scale alike. ===== */
.prog { container-type: inline-size; --ink: #1B1F1E; --accent: #333; --soft: #F4F4F2; font-family: var(--serif, Georgia, serif); color: var(--ink); }
.pg { container-type: inline-size; position: relative; background: #fff; width: 100%; aspect-ratio: 148 / 210; margin: 0 auto 14px; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.pg-cover { overflow: hidden; }
.pg-frame { position: absolute; inset: 5cqw; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 6cqw 6cqw; }
.pg-body { position: relative; inset: auto; margin: 5cqw; min-height: calc(100% - 10cqw); text-align: left; align-items: stretch; justify-content: flex-start; padding: 7cqw 7cqw; }
.pg:not(.pg-cover) { aspect-ratio: auto; min-height: calc(100cqw * 210 / 148); display: flex; flex-direction: column; }
.pg:not(.pg-cover) > .pg-body { flex: 1; min-height: 0; }
.pg-symbol { width: 7cqw; color: var(--accent); margin-bottom: 2cqw; }
.pg-symbol svg { width: 100%; height: auto; display: block; }
.pg-pre { font-style: italic; font-size: 4.2cqw; margin: 0 0 3cqw; }
.pg-photo { width: 46cqw; aspect-ratio: 3 / 4; border-radius: 999px 999px 2cqw 2cqw; overflow: hidden; background: #DDE2DF; margin-bottom: 4cqw; }
.pg-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pg-name { font-size: 8cqw; line-height: 1.12; margin: 0 0 2cqw; font-weight: 600; color: var(--accent); }
.pg-dates { font-size: 4cqw; margin: 0 0 2cqw; letter-spacing: .02em; }
.pg-epitaph { font-style: italic; font-size: 3.8cqw; margin: 0 0 3cqw; }
.pg-svc { font-size: 3.1cqw; margin: auto 0 0; color: #555; }
.pg h2 { font-size: 5.6cqw; color: var(--accent); margin: 0 0 3cqw; text-align: center; font-weight: 600; }
.pg h2:not(:first-child) { margin-top: 6cqw; }
.pg p, .pg li { font-size: 3.5cqw; line-height: 1.55; }
.pg-where { text-align: center; font-style: italic; color: #555; margin: 0 0 4cqw; }
.pg-order { list-style: none; padding: 0; margin: 0 0 4cqw; }
.pg-order li { display: flex; gap: 3cqw; padding: 1.5cqw 0; border-bottom: 1px dotted #bbb; }
.pg-order .t { flex: none; width: 15cqw; font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600; }
.pg-story p { margin: 0 0 3cqw; text-align: justify; hyphens: auto; }
.pg-hymns { margin: 0; padding-left: 6cqw; }
.pg-trib { margin: 0 0 4cqw; padding-left: 3cqw; border-left: .6cqw solid var(--accent); font-style: italic; }
.pg-trib p { margin: 0 0 1cqw; }
.pg-trib cite { display: block; font-size: 3.1cqw; font-style: normal; color: #555; }
.pg-verse { margin: 6cqw 0 4cqw; text-align: center; font-style: italic; }
.pg-verse cite { display: block; font-style: normal; font-size: 3.1cqw; margin-top: 1cqw; }
.pg-forever { text-align: center; font-size: 4.4cqw; color: var(--accent); margin-top: auto; }
.pg-credit { text-align: center; font-size: 2.4cqw !important; color: #888; font-family: system-ui, sans-serif; }

/* Classic */
.theme-classic { --accent: #1B1F1E; }
.theme-classic .pg-frame { border: 3px double #333; }

/* Jacaranda */
.theme-jacaranda { --accent: #5B4B8A; }
.theme-jacaranda .pg-frame { border: 1px solid #C9BFE3; }
.theme-jacaranda .pg::before, .theme-jacaranda .pg::after { content: ""; position: absolute; width: 26cqw; height: 26cqw; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='%238B78C2' opacity='.55'%3E%3Ccircle cx='14' cy='14' r='7'/%3E%3Ccircle cx='30' cy='9' r='5'/%3E%3Ccircle cx='9' cy='30' r='5'/%3E%3Ccircle cx='27' cy='25' r='4'/%3E%3Ccircle cx='44' cy='6' r='3'/%3E%3Ccircle cx='6' cy='44' r='3'/%3E%3C/g%3E%3C/svg%3E") no-repeat; z-index: 1; }
.theme-jacaranda .pg::before { top: 0; left: 0; }
.theme-jacaranda .pg::after { bottom: 0; right: 0; transform: rotate(180deg); }
.theme-jacaranda .pg-photo { box-shadow: 0 0 0 1.4cqw #EEEAF6; }

/* Kanga */
.theme-kanga { --accent: #46396D; }
.theme-kanga .pg { border: 4cqw solid transparent; border-image: repeating-linear-gradient(45deg, #5B4B8A 0 3cqw, #E2A23B 3cqw 5cqw, #1F3A34 5cqw 8cqw, #E2A23B 8cqw 10cqw) 30; }
.theme-kanga .pg-frame { inset: 2cqw; }
.theme-kanga .pg-body { margin: 2cqw; }
.theme-kanga .pg-name { color: #1F3A34; }
.theme-kanga .pg-pre, .theme-kanga .pg-forever { color: #A86D10; }

/* Garden */
.theme-garden { --accent: #2F5D46; }
.theme-garden .pg { background: #F3F7F2; }
.theme-garden .pg-frame { border: 1px solid #9DB8A6; border-radius: 3cqw; }
.theme-garden .pg-cover .pg-frame::after { content: ""; position: absolute; bottom: 3cqw; left: 50%; width: 30cqw; height: 6cqw; transform: translateX(-50%); background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 24'%3E%3Cpath d='M0 12h120' stroke='%232F5D46' stroke-width='1'/%3E%3Cpath d='M60 12c-8-10-18-10-24-6 6 2 14 6 24 6zm0 0c8-10 18-10 24-6-6 2-14 6-24 6z' fill='%232F5D46'/%3E%3C/svg%3E") no-repeat center / contain; }
.theme-garden .pg-photo { border-radius: 50%; aspect-ratio: 1; width: 44cqw; box-shadow: 0 0 0 1.2cqw #fff, 0 0 0 1.6cqw #9DB8A6; }

/* Modern */
.theme-modern { --accent: #14201D; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.theme-modern h1, .theme-modern h2 { font-family: inherit; }
.theme-modern .pg-cover { background: #14201D; }
.theme-modern .pg-cover .pg-frame { inset: 0; padding: 0; justify-content: flex-end; color: #fff; }
.theme-modern .pg-cover .pg-photo { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; margin: 0; }
.theme-modern .pg-cover .pg-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,32,29,0) 35%, rgba(20,32,29,.92) 80%); }
.theme-modern .pg-cover .pg-pre, .theme-modern .pg-cover .pg-symbol { position: absolute; top: 6cqw; left: 0; right: 0; z-index: 2; color: #fff; }
.theme-modern .pg-cover .pg-symbol { top: 13cqw; left: 46cqw; right: auto; }
.theme-modern .pg-cover .pg-pre { margin: 0; }
.theme-modern .pg-cover .pg-title { position: relative; z-index: 2; padding: 0 8cqw 9cqw; }
.theme-modern .pg-cover .pg-name { color: #fff; font-size: 9.5cqw; font-weight: 700; letter-spacing: -.01em; }
.theme-modern .pg-cover .pg-svc { color: #E2A23B; }
.theme-modern .pg h2 { text-align: left; border-bottom: .5cqw solid #E2A23B; padding-bottom: 1.5cqw; }

/* Crescent */
.theme-crescent { --accent: #1F6B4F; }
.theme-crescent .pg { background: #FBFAF4; }
.theme-crescent .pg-frame { border: 2px solid #C9A227; outline: 1px solid #C9A227; outline-offset: 1.2cqw; }
.theme-crescent .pg-cover .pg-frame { background-image: radial-gradient(circle at 50% 0, rgba(201,162,39,.12) 0 40%, transparent 41%); }
.theme-crescent .pg-photo { border-radius: 2cqw; }
.theme-crescent .pg-symbol { color: #C9A227; }

/* ===== Gallery + maker layout ===== */
.prog-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.5rem; }
.prog-card { display: flex; flex-direction: column; gap: .6rem; background: #fff; border-radius: 12px; padding: 1rem; border: 1px solid var(--mist, #ECEFEC); text-decoration: none; color: inherit; }
.prog-card:hover { border-color: var(--jacaranda, #5B4B8A); }
.prog-thumb { background: #DDE2DF; border-radius: 8px; padding: 10px; }
.prog-thumb .pg { margin: 0; }
.prog-card h2 { font-size: 1.1rem; margin: .2rem 0 0; }
.prog-card p { margin: 0; font-size: .9rem; color: var(--granite, #5F6B66); }
.prog-card .best { font-size: .8rem; }
.prog-maker { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 2rem; align-items: start; }
.prog-form fieldset { border: 0; padding: 0; margin: 0 0 1.5rem; }
.prog-form legend { font: 600 1.15rem var(--serif); padding: 0; margin-bottom: .75rem; }
.prog-form label { display: grid; gap: .3rem; font-size: .9rem; font-weight: 600; margin-bottom: .75rem; }
.prog-form input, .prog-form select, .prog-form textarea { width: 100%; min-height: 44px; padding: .5rem .7rem; font: inherit; font-weight: 400; border: 1px solid var(--stone, #D3D9D5); border-radius: 6px; background: #fff; }
.prog-form textarea { min-height: 120px; }
.design-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.design-pick label { position: relative; margin: 0; cursor: pointer; font-weight: 600; font-size: .8rem; text-align: center; }
.design-pick input { position: absolute; opacity: 0; }
.design-pick .prog-thumb { padding: 6px; border: 2px solid transparent; }
.design-pick input:checked + .prog-thumb { border-color: var(--jacaranda, #5B4B8A); }
.design-pick input:focus-visible + .prog-thumb { outline: 3px solid var(--candle, #E2A23B); }
.rep-row { display: grid; grid-template-columns: 110px 1fr auto auto; gap: .4rem; margin-bottom: .4rem; align-items: start; }
.rep-row.trib { grid-template-columns: 1fr auto auto; }
.rep-row.trib .rep-main { display: grid; gap: .4rem; }
.rep-row button { min-height: 44px; min-width: 40px; border: 1px solid var(--stone, #D3D9D5); background: #fff; border-radius: 6px; cursor: pointer; }
.prog-stage-wrap { position: sticky; top: 80px; }
.prog-stage { background: #D9DEDB; border-radius: 12px; padding: 14px; max-height: calc(100vh - 170px); overflow: auto; }
.prog-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.prog-tabs { display: none; }
@media (max-width: 900px) {
  .prog-maker { grid-template-columns: 1fr; }
  .prog-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; position: sticky; top: 64px; z-index: 5; background: var(--paper, #F6F7F5); padding: .5rem 0; }
  .prog-tabs button { min-height: 44px; border: 1px solid var(--stone, #D3D9D5); background: #fff; border-radius: 6px; font-weight: 600; }
  .prog-tabs button[aria-pressed="true"] { background: var(--slate, #1F3A34); color: #fff; }
  .prog-maker[data-view="edit"] .prog-stage-wrap { display: none; }
  .prog-maker[data-view="preview"] .prog-form { display: none; }
  .prog-stage-wrap { position: static; }
  .prog-stage { max-height: none; }
}

/* ===== Print: only the programme ===== */
@media print {
  html.printing-programme body > *:not(main) { display: none !important; }
  html.printing-programme main > *:not(.prog-page) { display: none !important; }
  html.printing-programme .prog-page > *:not(.prog-maker) { display: none !important; }
  html.printing-programme .prog-form, html.printing-programme .prog-tabs, html.printing-programme .prog-actions, html.printing-programme .prog-stage-wrap > *:not(.prog-stage) { display: none !important; }
  html.printing-programme .prog-maker { display: block; }
  html.printing-programme .prog-stage-wrap { display: block !important; position: static; }
  html.printing-programme .prog-stage { padding: 0; background: none; max-height: none; overflow: visible; }
  html.printing-programme body { background: #fff; }
  .pg { box-shadow: none; margin: 0; width: 148mm; break-after: page; page-break-after: always; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pg-cover { height: 210mm; aspect-ratio: auto; }
  .pg:not(.pg-cover) { min-height: 210mm; }
  .size-A4 .pg { width: 210mm; }
  .size-A4 .pg-cover { height: 297mm; }
  .size-A4 .pg:not(.pg-cover) { min-height: 297mm; }
}
