.gal-slide,.card-photo{position:relative}
.p27-photo-caption{position:absolute;left:0;right:0;bottom:0;padding:38px 24px 52px 34px;background:linear-gradient(transparent,rgba(0,0,0,.74));color:#fff;text-align:left;pointer-events:none;line-height:1.2;white-space:normal;box-sizing:border-box}
.p27-photo-caption::before{content:'';position:absolute;left:20px;top:40px;bottom:54px;width:3px;background:#e07a2f;border-radius:2px}
.p27-photo-title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;font-size:clamp(18px,2.6vw,36px);font-weight:750;letter-spacing:-.3px;text-shadow:0 1px 3px #0008}
.p27-photo-subtitle{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;margin-top:7px;font-size:clamp(12px,1.4vw,19px);font-weight:450;color:#efcf88;text-shadow:0 1px 3px #0008}
.p27-photo-title:empty,.p27-photo-subtitle:empty{display:none}
.card-photo .p27-photo-caption{padding:28px 16px 43px 25px}
.card-photo .p27-photo-caption::before{left:14px;top:30px;bottom:45px;width:2px}
.card-photo .p27-photo-title{font-size:clamp(14px,1.2vw,18px);-webkit-line-clamp:2;letter-spacing:0}
.card-photo .p27-photo-subtitle{margin-top:4px;font-size:11px;-webkit-line-clamp:1}
.photo-modal .p27-photo-caption-full{position:absolute;left:50%;right:auto;transform:translateX(-50%);bottom:54px;width:min(900px,90%);padding:30px 24px 20px 34px;border-radius:8px}
.photo-modal .p27-photo-caption-full::before{bottom:22px}
@media(max-width:600px){.gal-slide .p27-photo-caption,.gallery-track>.p27-photo-caption{padding:26px 16px 48px 25px}.gal-slide .p27-photo-caption::before,.gallery-track>.p27-photo-caption::before{left:14px;top:28px;bottom:50px;width:2px}.gal-slide .p27-photo-title{font-size:18px;-webkit-line-clamp:2}.gal-slide .p27-photo-subtitle{font-size:12px;margin-top:4px;-webkit-line-clamp:1}}
.p27-photo-edit-open{display:block;margin:7px 12px;padding:7px 10px;border:1px solid #dcc7ae;border-radius:8px;background:#fff8ef;color:#9c3b12;font:inherit;font-size:13px;cursor:pointer}
.p27-photo-editor{width:min(760px,calc(100% - 24px));max-height:88dvh;padding:0;border:1px solid #ded2c3;border-radius:16px;background:#fffdf8;color:#25211d;box-shadow:0 14px 70px #0004}
.p27-photo-editor::backdrop{background:#0007}
.p27-photo-editor-head{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:14px 16px;border-bottom:1px solid #e5ddcf}
.p27-photo-editor-head h3{margin:0;font-size:18px;text-transform:none;letter-spacing:0}.p27-photo-editor-head button{width:38px;height:38px;border:0;border-radius:8px;font-size:24px;background:#f1ece4;cursor:pointer}
.p27-photo-editor-body{padding:12px 16px;overflow:auto;max-height:calc(88dvh - 72px)}
.p27-photo-edit-row{display:grid;grid-template-columns:88px minmax(0,1fr);gap:12px;padding:14px 0;border-bottom:1px solid #e5ddcf}
.p27-photo-edit-row img{width:88px;height:70px;object-fit:cover;border-radius:6px}
.p27-photo-edit-row small{display:block;font-size:11px;color:#81786c;overflow-wrap:anywhere}
.p27-photo-edit-row label{display:block;font-size:12px;font-weight:600;margin-bottom:8px}
.p27-photo-edit-row input,.p27-photo-edit-row textarea{display:block;box-sizing:border-box;width:100%;padding:8px 10px;margin-top:3px;border:1px solid #d6cbbb;border-radius:6px;background:#fff;color:#221f1a;font:inherit;font-size:15px;resize:vertical}
.p27-photo-edit-row button{min-height:36px;border:0;border-radius:7px;background:#9c3b12;color:#fff;padding:7px 12px;cursor:pointer}
.p27-photo-edit-row button:disabled{opacity:.6;cursor:default}
.p27-photo-edit-status{font-size:12px;margin:6px 0 0;line-height:1.4}
@media(max-width:600px){.p27-photo-edit-row{grid-template-columns:60px minmax(0,1fr);gap:8px}.p27-photo-edit-row img{width:60px;height:52px}.p27-photo-editor-body{padding:8px 12px}.p27-photo-edit-row input,.p27-photo-edit-row textarea{font-size:16px}}

/* Keep detail captions at the image edge; catalogue captions start at the top. */
#gal-count,#photo-count{display:none!important}
.gal-slide .p27-photo-caption,.gallery-track>.p27-photo-caption{padding-bottom:16px}
.gal-slide .p27-photo-caption::before,.gallery-track>.p27-photo-caption::before{bottom:18px}
.card-photo .p27-photo-caption{top:auto;bottom:0;padding:28px 16px 12px 25px;background:linear-gradient(transparent,rgba(0,0,0,.74));z-index:1}
.card-photo .p27-photo-caption::before{top:30px;bottom:14px}
.card-photo-nav{z-index:3}
.photo-modal .p27-photo-caption-full{padding-bottom:12px}
.photo-modal .p27-photo-caption-full::before{bottom:14px}
@media(max-width:600px){.gal-slide .p27-photo-caption,.gallery-track>.p27-photo-caption{padding-bottom:12px}.gal-slide .p27-photo-caption::before,.gallery-track>.p27-photo-caption::before{bottom:14px}}
.p27-photo-manager-toolbar{padding:6px 0 10px;display:flex;gap:10px;align-items:center;flex-wrap:wrap}.p27-photo-manager-toolbar>button{padding:10px 14px;border:0;border-radius:8px;color:white;background:#9c3b12;cursor:pointer;font:inherit;font-size:14px}.p27-photo-manager-toolbar small{color:#786d60;font-size:12px;flex:1;min-width:180px}.p27-photo-manager-toolbar>.p27-photo-edit-status{flex-basis:100%;margin:0}.p27-photo-manager-note{font-size:13px;color:#786d60}.p27-photo-moves{display:flex;flex-wrap:wrap;gap:4px;margin-top:8px}.p27-photo-moves button,.p27-deleted-photo button,.p27-photo-caption-actions button:last-child,.p27-photo-discard button{padding:7px 9px;min-height:34px;border:1px solid #d8c4ac;border-radius:6px;background:#fff9ef;color:#9c3b12;cursor:pointer;font:12px/1.3 system-ui}.p27-photo-moves .p27-photo-remove{flex-basis:100%}.p27-photo-caption-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.p27-photo-editor [disabled]{opacity:.5;cursor:default}.p27-deleted-photos{margin-top:16px;padding:12px;border:1px solid #e3d5c3;border-radius:8px}.p27-deleted-photos summary{cursor:pointer;font-weight:600}.p27-deleted-photo{display:flex;align-items:center;gap:10px;padding-top:10px}.p27-deleted-photo img{width:56px;height:44px;object-fit:cover;border-radius:5px}.p27-deleted-photo span{flex:1;font-size:12px;overflow-wrap:anywhere;min-width:0}.p27-photo-discard{padding:12px;background:#fff0db;border-radius:8px;font-size:14px}.p27-photo-discard button{margin:8px 6px 0 0}@media(max-width:600px){.p27-photo-edit-row{grid-template-columns:74px minmax(0,1fr);gap:10px}.p27-photo-edit-row img{width:74px;height:64px}.p27-photo-edit-row input,.p27-photo-edit-row textarea{font-size:16px}.p27-photo-moves button{min-height:40px}.p27-deleted-photo{flex-wrap:wrap}}
.p27-photo-variant{position:absolute;left:10px;top:10px;z-index:2;max-width:calc(100% - 76px);padding:5px 9px;border-radius:8px;background:#fffdf0ed;color:#3e2b1c;font:600 12px/1.35 system-ui;pointer-events:none;box-shadow:0 1px 4px #0002;white-space:normal;overflow-wrap:anywhere}.gal-slide>.p27-photo-variant{left:64px;top:14px;max-width:calc(100% - 176px)}.photo-modal>.p27-photo-variant{font-size:13px;z-index:3}

/* First-frame title remains live text and scales independently of the photograph. */
.gal-slide[data-hero-title]{container-type:inline-size}
.p27-photo-hero{position:absolute;left:5%;top:50%;transform:translateY(-50%);z-index:2;isolation:isolate;max-width:85%;text-align:left;pointer-events:none;font-size:clamp(28px,8vw,88px);font-size:clamp(28px,8cqw,88px);font-weight:800;line-height:.96;letter-spacing:-.025em;text-shadow:0 2px 8px rgba(0,0,0,.18)}
.p27-photo-hero::before{content:"";position:absolute;z-index:-1;inset:-65% -35% -65% -25%;background:radial-gradient(ellipse at 42% 50%,rgba(0,17,31,.8) 0%,rgba(0,17,31,.55) 35%,rgba(0,17,31,.16) 58%,transparent 76%);filter:blur(16px);pointer-events:none}
.p27-photo-hero-first,.p27-photo-hero-second{display:block;white-space:nowrap}
.p27-photo-hero-first{color:#fff}
.p27-photo-hero-second{color:#ffda00;margin-top:0}

@media(max-width:640px){
 .gal-slide>.p27-photo-hero{top:auto;bottom:18px;transform:none;max-width:90%;font-size:clamp(34px,11vw,56px);font-size:clamp(34px,11cqw,56px)}
}

/* Inline controls stay outside the swipe surface. */
.p27-gallery-admin{padding:8px 12px;background:#fff8ef;border-bottom:1px solid #dcc7ae;color:#543923}
.p27-gallery-admin-actions{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.p27-gallery-admin button{min-height:44px;min-width:44px;padding:8px 12px;border:1px solid #dcc7ae;border-radius:8px;background:#fffdf8;color:#9c3b12;font:14px/1.2 system-ui;cursor:pointer}
.p27-gallery-admin button:disabled{opacity:.4;cursor:default}.p27-gallery-admin [hidden]{display:none}
.p27-gallery-admin .p27-photo-edit-status:empty{display:none}.p27-gallery-admin .p27-photo-edit-status{margin:7px 0 0}
.p27-gallery-caption-form{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
.p27-gallery-caption-form label{display:flex;flex-direction:column;gap:5px;flex:1 1 240px;font-size:13px}
.p27-gallery-caption-form input,.p27-gallery-caption-form textarea{width:100%;box-sizing:border-box;border:1px solid #dcc7ae;border-radius:8px;padding:9px;font:16px/1.3 system-ui;color:#25211d;background:white}
.p27-gallery-editable .p27-photo-caption,.p27-gallery-editable .p27-photo-hero{pointer-events:auto;cursor:text}

.p27-gallery-admin{max-width:1120px;margin:0 auto;box-sizing:border-box}.p27-gallery-admin .p27-photo-edit-open{margin:0}.p27-gallery-caption-form{align-items:end}
@media(max-width:600px){.p27-gallery-caption-form label{flex-basis:100%;min-width:0}}

.p27-photo-add-caption{position:absolute;left:18px;bottom:18px;z-index:6;min-height:44px;padding:10px 14px;border:1px dashed #c7a985;border-radius:9px;background:#fffdf9e8;color:#9c3b12;box-shadow:0 2px 10px #0001;font:14px/1.3 system-ui;cursor:pointer}
.p27-photo-add-caption:hover{background:#fff5e5;border-color:#9c3b12}.p27-photo-add-caption[hidden]{display:none}.p27-photo-add-caption:disabled{opacity:.5;cursor:default}
@media(max-width:640px){.p27-photo-add-caption{left:12px;bottom:12px}}
