/* Public content areas: restrained, theme-friendly defaults with responsive layouts. */
.pencil-ec-area { --pencil-ec-gap: clamp(1.1rem, 3vw, 2rem); width: 100%; min-width: 0; }
.pencil-ec-sections { display: grid; gap: clamp(2rem, 5vw, 4.5rem); }
.pencil-ec-section { max-width: 100%; min-width: 0; }
.pencil-ec-title { margin: 0 0 1rem; font-size: clamp(1.55rem, 2.6vw, 2.4rem); line-height: 1.2; }
.pencil-ec-body { max-width: 75ch; line-height: 1.7; }
.pencil-ec-body p { margin: 0 0 .85em; }
.pencil-ec-split { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: center; gap: var(--pencil-ec-gap); }
.pencil-ec-split--left .pencil-ec-image { order: -1; }
.pencil-ec-image { border-radius: 16px; overflow: hidden; }
.pencil-ec-photo { display: block; width: 100%; height: auto; max-height: 550px; aspect-ratio: 4 / 3; object-fit: cover; }
.pencil-ec-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 12px; }
.pencil-ec-gallery--masonry { display: block; columns: 3 210px; column-gap: 12px; }
.pencil-ec-gallery--masonry .pencil-ec-gallery-item { break-inside: avoid; margin-bottom: 12px; }
.pencil-ec-gallery--masonry .pencil-ec-gallery-item img { aspect-ratio: auto; }
.pencil-ec-gallery-item { margin: 0; min-width: 0; }
.pencil-ec-gallery-item img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; }
.pencil-ec-gallery-item figcaption { font-size: .88em; line-height: 1.5; padding: 7px 2px 0; }
.pencil-ec-documents { display: grid; gap: 8px; list-style: none; padding: 0; margin: 0; }
.pencil-ec-documents a { display: flex; gap: .7em; align-items: center; padding: .85em 1em; border: 1px solid #dce1e8; border-radius: 11px; text-decoration: none; }
.pencil-ec-documents a::before { content: '↧'; font-size: 1.2em; font-weight: 700; }
.pencil-ec-cards { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,230px),1fr)); gap: var(--pencil-ec-gap); }
.pencil-ec-card { padding: 1.4rem; border: 1px solid #e5e7eb; border-radius: 14px; background: #fff; color: #1f2937; }
.pencil-ec-card h3 { margin: 0 0 .8rem; font-size: 1.25rem; }
.pencil-ec-card p { line-height: 1.6; }
.pencil-ec-faq { border-bottom: 1px solid #d1d5db; padding: 1.1rem 0; }
.pencil-ec-faq summary { font-weight: 650; cursor: pointer; }
.pencil-ec-faq div { padding: .8rem .2rem 0; line-height: 1.7; }
.pencil-field--missing-image { background: #f4f3f9; border: 2px dashed #b7afd5; border-radius: 10px; min-height: 140px; max-height: 270px; padding: 25px; object-fit: contain; }
@media(max-width: 670px) { .pencil-ec-split { grid-template-columns: 1fr; } .pencil-ec-split--left .pencil-ec-image { order: 0; } }

/* Editor controls: deliberately outside the client's content styling. */
.pencil-ec-area.pencil-ec-editing { outline: 2px dashed #7c3aed; outline-offset: 7px; min-height: 90px; }
.pencil-ec-area .pencil-ec-open { display: none; }
.pencil-ec-area.pencil-ec-editing > .pencil-ec-open:not([hidden]) {
  display: inline-flex; position: relative; z-index: 100; margin: 8px 0 14px; padding: 10px 15px;
  background: #6d28d9; border: 0; border-radius: 10px; color: #fff; font-size: 14px;
  font-weight: 700; cursor: pointer; box-shadow: 0 6px 20px #0002;
}
.pencil-ec-panel.pencil-ui { all: initial; box-sizing: border-box; --pencil-accent: #7c3aed;
  position: fixed; z-index: 2147483050; top: 0; right: 0; bottom: 0;
  width: min(440px, 100vw); padding: 0 19px 30px; overflow-y: auto; overscroll-behavior: contain;
  background: #fff; color: #1f2937; box-shadow: -15px 0 65px #0f172a50;
  font: 14px/1.48 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
.pencil-ec-panel.pencil-ui * { box-sizing: border-box; }
.pencil-ec-panel[hidden] { display: none !important; }
.pencil-ec-panel-header { display: flex; justify-content: space-between; gap: 12px; align-items: center; position: sticky; top: 0;
  background: #fff; z-index: 2; padding: 20px 0 13px; border-bottom: 1px solid #e5e7eb; }
.pencil-ec-panel-header strong { display: block; font-size: 21px; color: #161127; }
.pencil-ec-panel-header small { color: #6b7280; display: block; }
.pencil-ec-panel .pencil-ec-close { font-size: 28px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #f3f4f6; color: #111827; }
.pencil-ec-hint { font-size: 13px; color: #475569; margin: 14px 0 16px; }
.pencil-ec-error { border-left: 4px solid #dc2626; background: #fef2f2; color: #991b1b; padding: 10px; margin: 10px 0; }
.pencil-ec-error[hidden],.pencil-ec-form[hidden] { display: none; }
.pencil-ec-item { padding: 12px; background: #f8f7fb; border-radius: 12px; border: 1px solid #e8e4f0; margin: 9px 0; }
.pencil-ec-item-name { display: flex; gap: 8px; align-items: start; justify-content: space-between; }
.pencil-ec-item-name strong { font-size: 14px; max-width: 240px; }
.pencil-ec-item-name small { color: #6b7280; white-space: nowrap; }
.pencil-ec-item-actions { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 10px; }
.pencil-ec-panel button { appearance: none; background: #fff; border: 1px solid #cbd5e1; border-radius: 8px;
  padding: 7px 10px; font: inherit; font-size: 12px; font-weight: 600; color: #1f2937; cursor: pointer; }
.pencil-ec-panel button:hover { background: #f1f5f9; }
.pencil-ec-panel button:focus-visible,.pencil-ec-area .pencil-ec-open:focus-visible { outline: 3px solid #fbbf24; outline-offset: 2px; }
.pencil-ec-panel button:disabled { opacity: .55; cursor: progress; }
.pencil-ec-add { margin: 20px 0; padding-top: 12px; border-top: 1px solid #e5e7eb; }
.pencil-ec-add h3,.pencil-ec-form h3 { font-size: 16px; margin: 8px 0 12px; }
.pencil-ec-type-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.pencil-ec-type-grid button { padding: 14px 10px; border: 1px solid #ddd6fe; background: #faf8ff; color: #581c87; text-align: left; }
.pencil-ec-form { margin: 20px 0; padding: 16px; border: 1px solid #ddd6fe; border-radius: 13px; background: #fdfcff; }
.pencil-ec-input-wrap { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; font-size: 12px; font-weight: 700; color: #334155; }
.pencil-ec-input { display: block; width: 100%; min-width: 0; min-height: 40px; padding: 9px 10px; border: 1px solid #cbd5e1;
  border-radius: 8px; background: #fff; font: inherit; font-size: 14px; line-height: 1.45; color: #0f172a; }
.pencil-ec-input:focus { outline: 2px solid #a78bfa; border-color: #a78bfa; }
textarea.pencil-ec-input { min-height: 120px; resize: vertical; }
.pencil-ec-form-footer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.pencil-ec-panel .pencil-ec-done,.pencil-ec-panel .pencil-ec-additem { background: #6d28d9; border-color: #6d28d9; color: #fff; }
.pencil-ec-panel .pencil-ec-done:hover,.pencil-ec-panel .pencil-ec-additem:hover { background: #5b21b6; }
.pencil-ec-actions { position: sticky; bottom: 0; display: flex; gap: 9px; padding: 14px 0;
  background: #fff; border-top: 1px solid #e5e7eb; z-index: 3; }
.pencil-ec-actions button { flex: 1; min-height: 42px; }
.pencil-ec-panel .pencil-ec-publish { color: #fff; background: #166534; border-color: #166534; }
.pencil-ec-panel .pencil-ec-publish:hover { background: #14532d; }
.pencil-ec-secondary { display: flex; gap: 8px; justify-content: space-between; }
.pencil-ec-secondary button { border: 0; background: transparent; color: #6b7280; text-decoration: underline; }
.pencil-ec-subitem,.pencil-ec-media-row,.pencil-ec-media-choice,.pencil-ec-history-entry { border: 1px solid #e2e8f0; padding: 10px; border-radius: 9px; margin: 10px 0; }
.pencil-ec-history-entry { display: grid; gap: 9px; }
.pencil-ec-empty { padding: 20px; background: #f8fafc; border: 1px dashed #94a3b8; border-radius: 10px; }
@media (prefers-reduced-motion: reduce) { .pencil-ec-panel * { scroll-behavior: auto !important; } }
.pencil-ec-lightbox-open { overflow: hidden; }
.pencil-ec-lightbox { position: fixed; z-index: 2147483400; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(5,8,17,.95); padding: 18px 55px; color: #fff; font: 15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
.pencil-ec-lightbox-content { display: flex; flex-direction: column; align-items: center; justify-content: center; max-width: 100%; max-height: 100%; }
.pencil-ec-lightbox-image { display: block; max-width: 100%; max-height: min(80vh,1000px); width: auto; height: auto; object-fit: contain; }
.pencil-ec-lightbox-caption { margin: 12px 0 0; font-size: 14px; text-align: center; }
.pencil-ec-lightbox button { position: absolute; border: 1px solid #ffffff66; border-radius: 50%; width: 40px; height: 40px;
  background: #0007; color: #fff; font-size: 30px; line-height: 1; cursor: pointer; }
.pencil-ec-lightbox button:focus-visible { outline: 3px solid #fbbf24; outline-offset: 3px; }
.pencil-ec-lightbox-close { top: 15px; right: 15px; }
.pencil-ec-lightbox-prev { left: 8px; top: 50%; }
.pencil-ec-lightbox-next { right: 8px; top: 50%; }
@media(max-width:600px) { .pencil-ec-lightbox { padding: 16px 38px; } .pencil-ec-lightbox button { width: 32px; height: 32px; } }

/* Let WordPress's native media modal appear above the side panel. */
html.pencil-media-open .pencil-ec-panel { visibility: hidden; pointer-events: none; }
