
:root{
  --bg:#fff; --fg:#111; --muted:#6b6b6b; --border:#e6e6e6;
  --gap:18px; --card-max:416px; --thumb-max:320px;
  --menu-size:14px;

  /* MENU button vars */
  --menu-btn-bg:#f4f4f4; --menu-btn-fg:#222; --menu-btn-border:#d7d7d7; --menu-btn-hover-border:#bdbdbd; --menu-btn-active-bg:#f4f4f4;
  --menu-btn-radius:10px; --menu-btn-fw:500;
  /* LANG button vars */
  --lang-btn-bg:#111; --lang-btn-fg:#fff; --lang-btn-border:#111; --lang-btn-hover-border:#444; --lang-btn-active-bg:#111;
  --lang-btn-radius:999px; --lang-btn-fw:500;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{display:flex;flex-direction:column;min-height:100vh;background:var(--bg);color:#111;font-family:var(--font-family, Inter, system-ui, Arial, Helvetica, sans-serif); text-align:center;}
a{color:#555;text-decoration:none}
a:hover{text-decoration:none}
.container{max-width:1200px;margin:0 auto;padding:24px;flex:1 0 auto}
.topbar{display:flex;flex-direction:column;align-items:center;gap:14px}
.logo img{width:min(312px, 52vw);height:auto;display:block}

/* MENU */
.nav{display:flex;gap:10px;flex-wrap:wrap;align-items:center;justify-content:var(--menu-align, center);width:100%}
.nav a{padding:6px 12px;border-radius:var(--menu-btn-radius);font-weight:var(--menu-btn-fw);transition:background .15s ease,color .15s ease,border-color .15s ease; border:1px solid transparent; font-size:var(--menu-size); text-transform:var(--menu-transform, none);}
body.menu-btn-outline .nav a{background:transparent;color:var(--menu-fg, #545454);border-color:transparent}
body.menu-btn-outline .nav a:hover{background:transparent;border-color:var(--menu-btn-hover-border);color:#333}
body.menu-btn-outline .nav a.active{background:var(--menu-btn-active-bg);border-color:transparent;color:#222}
body.menu-btn-filled .nav a{background:var(--menu-btn-bg);color:var(--menu-btn-fg);border-color:var(--menu-btn-bg)}
body.menu-btn-filled .nav a:hover{border-color:var(--menu-btn-hover-border)}
body.menu-btn-filled .nav a.active{background:var(--menu-btn-active-bg)}

/* Language button */
.lang-toggle{position:fixed;top:12px;right:12px;z-index:1200;display:flex;align-items:center;gap:10px}
.lang-btn{border:1px solid var(--lang-btn-border);background:var(--lang-btn-bg);color:var(--lang-btn-fg);padding:6px 12px;border-radius:var(--lang-btn-radius);font-size:11px;font-weight:var(--lang-btn-fw);letter-spacing:.02em;cursor:pointer;opacity:.95}
.lang-btn:hover{opacity:1; border-color:var(--lang-btn-hover-border)}
#logout-btn{cursor:pointer}
#logout-btn:hover{opacity:1;border-color:#999}

/* Spacing */
.gap{height:24px}
.gap-home{height:72px}
.sep-lg{height:28px}
.sep-xl{height:40px}

/* Title */
.page-title{font-size:22px;font-weight:600;letter-spacing:.01em;margin:8px 0}

/* Rich text */
.project-text{max-width:70ch;margin:0 auto; text-align:justify; text-justify:inter-word; line-height:1.6; hyphens:auto; -webkit-hyphens:auto; -ms-hyphens:auto; word-wrap:break-word;}
.project-text p{margin:0 0 1em}
.project-text b, .project-text strong{font-weight:700}
.project-text i, .project-text em{font-style:italic}
body.page-contact .project-text, body.page-shop .project-text{ text-align:center; text-justify:auto; }

/* Home cards */
.grid-cards{display:grid;grid-template-columns:repeat(var(--cols,2),1fr);gap:calc(var(--gap) + 10px);justify-items:center}
.card{width:100%;max-width:var(--card-max);aspect-ratio:1/1;height:var(--card-height, auto);border-radius:var(--card-border-radius, 14px);overflow:hidden;position:relative;background:#f7f7f7;display:flex;align-items:center;justify-content:center;border:1px solid var(--border);box-shadow:0 2px 6px rgba(0,0,0,.06)}
.card::before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(var(--hover-gradient-direction, to top), rgba(0,0,0,var(--hover-gradient-opacity, .55)) 0%, rgba(0,0,0,0) var(--hover-gradient-size, 60%));opacity:0;transition:opacity var(--hover-label-speed, .18s) ease;pointer-events:none;z-index:1}
.card img{width:100%;height:100%;object-fit:cover;display:block;filter:grayscale(var(--hover-grayscale, 0));transition:transform var(--hover-duration, .22s) ease, filter var(--hover-duration, .22s) ease}
.card .label{position:absolute;left:var(--card-caption-x, 50%);top:var(--card-caption-y, 100%);transform:translate(-50%, -50%);color:#fff;text-align:center;padding:10px 8px;font-weight:var(--card-caption-weight, 500);font-size:var(--card-caption-size, 14px);letter-spacing:.01em;opacity:0;transition:opacity var(--hover-label-speed, .18s) ease;z-index:2;white-space:nowrap;font-family:var(--card-caption-font, inherit)}
.card:hover::before{opacity:1}
.card:hover img{transform:scale(var(--hover-scale, 1.03));filter:grayscale(0) brightness(var(--hover-brightness, .9))}
.card:hover .label{opacity:1}

/* Galleries */
.grid-gallery{display:grid;grid-template-columns:1fr;gap:var(--gap);justify-content:center}
.grid-thumbs{display:grid;grid-template-columns:repeat(var(--effective-cols, var(--cols,3)),1fr);gap:var(--gap);justify-content:center}
#project-content{display:flex;flex-wrap:wrap;gap:var(--gap);justify-content:center;align-items:flex-start}
#project-content > .thumb{min-width:0;width:calc((100% - (var(--effective-cols, var(--cols,3)) - 1) * var(--gap)) / var(--effective-cols, var(--cols,3)));flex:0 0 calc((100% - (var(--effective-cols, var(--cols,3)) - 1) * var(--gap)) / var(--effective-cols, var(--cols,3)));max-width:calc((100% - (var(--effective-cols, var(--cols,3)) - 1) * var(--gap)) / var(--effective-cols, var(--cols,3)))}
#project-content > .project-text-block,
#project-content > .project-image-row{flex:0 0 100%;max-width:100%}
.project-text-block{padding:30px 0;line-height:1.8;font-size:16px;max-width:800px;margin:0 auto;width:100%;text-align:center}
.project-text-block p{margin:0 0 1em 0}
.project-text-block p:last-child{margin-bottom:0}
.project-image-row{--row-cols:var(--effective-cols, var(--cols,3));display:flex;flex-wrap:wrap;gap:var(--gap);align-items:start;justify-content:center;width:100%}
.project-image-block{min-width:0;width:calc((100% - (var(--row-cols) - 1) * var(--gap)) / var(--row-cols));flex:0 0 calc((100% - (var(--row-cols) - 1) * var(--gap)) / var(--row-cols));max-width:calc((100% - (var(--row-cols) - 1) * var(--gap)) / var(--row-cols))}
.thumb{width:100%;max-width:var(--thumb-max);aspect-ratio:1/1;height:var(--thumb-height, auto);border-radius:var(--thumb-border-radius, 12px);overflow:hidden;position:relative;border:1px solid var(--border);cursor:pointer;box-shadow:0 2px 6px rgba(0,0,0,.06);margin:0 auto}
.thumb::before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(var(--thumb-hover-gradient-direction, to top), rgba(0,0,0,var(--thumb-hover-gradient-opacity, .55)) 0%, rgba(0,0,0,0) var(--thumb-hover-gradient-size, 60%));opacity:0;transition:opacity .18s ease;pointer-events:none;z-index:1}
.thumb img{width:100%;height:100%;object-fit:cover;display:block;filter:grayscale(var(--thumb-hover-grayscale, 0));transition:transform .22s ease, filter .18s ease}
.thumb:hover::before{opacity:1}
.thumb:hover img{transform:scale(var(--thumb-hover-scale, 1.04));filter:grayscale(0) brightness(var(--thumb-hover-brightness, .9))}
.thumb .caption, .page-hero .frame .caption{position:absolute;left:var(--thumb-caption-x, 50%);top:var(--thumb-caption-y, 100%);transform:translate(-50%, -50%);color:#fff;text-align:center;padding:8px 6px;font-size:var(--thumb-caption-size, 13px);font-weight:var(--thumb-caption-weight, 500);opacity:0;transition:opacity .18s ease;z-index:2;white-space:nowrap;font-family:var(--thumb-caption-font, inherit)}
.thumb:hover .caption, .page-hero .frame:hover .caption{opacity:1}


.card.hover-disabled::before, .thumb.hover-disabled::before, .page-hero .frame.hover-disabled::before{display:none !important}
.card.hover-disabled:hover img{transform:none !important;filter:grayscale(var(--hover-grayscale, 0)) !important}
.thumb.hover-disabled:hover img, .page-hero .frame.hover-disabled:hover img{transform:none !important;filter:grayscale(var(--thumb-hover-grayscale, 0)) !important}
.card.hover-disabled:hover .label, .thumb.hover-disabled:hover .caption, .page-hero .frame.hover-disabled:hover .caption{opacity:0 !important}

/* Per-item display modes */
.card.display-square, .thumb.display-square, .page-hero .frame.display-square{aspect-ratio:1/1;height:auto}
.card.display-portrait, .thumb.display-portrait, .page-hero .frame.display-portrait{aspect-ratio:3/4;height:auto}
.card.display-landscape, .thumb.display-landscape, .page-hero .frame.display-landscape{aspect-ratio:16/10;height:auto}
.card.display-square img, .card.display-portrait img, .card.display-landscape img,
.thumb.display-square img, .thumb.display-portrait img, .thumb.display-landscape img,
.page-hero .frame.display-square img, .page-hero .frame.display-portrait img, .page-hero .frame.display-landscape img{width:100%;height:100%;object-fit:cover}
.card.display-contain-width, .thumb.display-contain-width, .page-hero .frame.display-contain-width{aspect-ratio:auto;height:auto;display:flex;align-items:center;justify-content:center}
.card.display-contain-width img, .thumb.display-contain-width img, .page-hero .frame.display-contain-width img{width:100%;height:auto;object-fit:contain}
.card.display-contain-height, .thumb.display-contain-height, .page-hero .frame.display-contain-height{aspect-ratio:auto;display:flex;align-items:center;justify-content:center}
.card.display-contain-height{height:var(--card-height,420px)}
.thumb.display-contain-height{height:var(--thumb-height,360px)}
.page-hero .frame.display-contain-height{height:min(70vh, 560px)}
.card.display-contain-height img, .thumb.display-contain-height img, .page-hero .frame.display-contain-height img{width:auto;height:100%;object-fit:contain}
.page-hero .frame.display-square, .page-hero .frame.display-portrait, .page-hero .frame.display-landscape, .page-hero .frame.display-contain-width{width:min(560px, 92vw)}

/* Per-page thumb shapes */
body.thumb-home-auto .card{aspect-ratio:auto}
body.thumb-home-auto .card img{width:100%;height:auto;object-fit:contain}
body.thumb-cat-auto #category-grid .thumb{aspect-ratio:auto}
body.thumb-cat-auto #category-grid .thumb img{width:100%;height:auto;object-fit:contain}
body.thumb-prj-auto #project-content .thumb{aspect-ratio:auto}
body.thumb-prj-auto #project-content .thumb img{width:100%;height:auto;object-fit:contain}

/* Page hero images */
.page-hero{display:flex;justify-content:center}
.page-hero .frame{border-radius:14px;border:1px solid var(--border);overflow:hidden;box-shadow:0 2px 6px rgba(0,0,0,.06);position:relative}
.page-hero .frame::before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(var(--thumb-hover-gradient-direction, to top), rgba(0,0,0,var(--thumb-hover-gradient-opacity, .55)) 0%, rgba(0,0,0,0) var(--thumb-hover-gradient-size, 60%));opacity:0;transition:opacity .18s ease;pointer-events:none;z-index:1}
.page-hero img{width:100%;height:auto;display:block;transition:transform .22s ease, filter .18s ease;filter:grayscale(var(--thumb-hover-grayscale, 0))}
.page-hero .frame:hover::before{opacity:1}
.page-hero .frame:hover img{transform:scale(var(--thumb-hover-scale, 1.04));filter:grayscale(0) brightness(var(--thumb-hover-brightness, .9))}
.page-hero .frame--bio{width:min(420px, 70vw);} /* BIO pionowo */
.page-hero .frame--contact{width:min(420px, 70vw);}
.page-hero .frame--shop{width:min(420px, 70vw);}

/* Mobile: always show captions, except project galleries where captions should appear in slideshow after tap */
@media (max-width: 768px) {
  .thumb .caption, .page-hero .frame .caption { opacity: 1 !important; }
  .card .label { opacity: 1 !important; }
  #project-content .project-image-block .caption,
  #project-content > .thumb .caption,
  #project-content .project-image-row .caption {
    opacity: 0 !important;
    pointer-events: none;
  }
}

/* Inline editing buttons */
.inline-edit-logo-btn{position:absolute;top:0;right:-110px;padding:8px 16px;background:#111;color:#fff;border:1px solid #111;border-radius:10px;font-size:13px;font-weight:500;cursor:pointer;transition:all .2s ease;box-shadow:0 2px 6px rgba(0,0,0,.15);z-index:100;white-space:nowrap}
.inline-edit-logo-btn:hover{background:#333;border-color:#333;transform:translateY(-1px);box-shadow:0 3px 8px rgba(0,0,0,.25)}
.inline-edit-img-btn{position:absolute;top:12px;right:12px;padding:8px 16px;background:#111;color:#fff;border:1px solid #111;border-radius:10px;font-size:13px;font-weight:500;cursor:pointer;transition:all .2s ease;box-shadow:0 2px 6px rgba(0,0,0,.15);z-index:100}
.inline-edit-img-btn:hover{background:#333;border-color:#333;transform:translateY(-1px);box-shadow:0 3px 8px rgba(0,0,0,.25)}
.inline-edit-text-btn{position:absolute;top:-40px;right:0;padding:8px 16px;background:#111;color:#fff;border:1px solid #111;border-radius:10px;font-size:13px;font-weight:500;cursor:pointer;transition:all .2s ease;box-shadow:0 2px 6px rgba(0,0,0,.15)}
.inline-edit-text-btn:hover{background:#333;border-color:#333;transform:translateY(-1px);box-shadow:0 3px 8px rgba(0,0,0,.25)}
.inline-edit-btn-primary{padding:10px 20px;background:#111;color:#fff;border:1px solid #111;border-radius:10px;font-weight:500;font-size:14px;cursor:pointer;transition:all .2s ease}
.inline-edit-btn-primary:hover{background:#222;border-color:#222}
.inline-edit-btn-secondary{padding:10px 20px;background:transparent;color:#111;border:1px solid #ddd;border-radius:10px;font-weight:500;font-size:14px;cursor:pointer;transition:all .2s ease}
.inline-edit-btn-secondary:hover{background:#f4f4f4;border-color:#ccc}
.inline-edit-modal{position:fixed;inset:0;background:rgba(0,0,0,.7);display:flex;align-items:center;justify-content:center;z-index:3000;padding:20px}
.inline-edit-modal-content{background:#fff;border-radius:12px;padding:28px;max-width:640px;width:100%;max-height:90vh;overflow-y:auto;box-shadow:0 8px 32px rgba(0,0,0,.2)}
.inline-edit-modal-content h3{margin:0 0 20px;font-size:20px;font-weight:600;color:#111}
.inline-edit-modal-content label{display:block;margin:16px 0 6px;font-weight:600;font-size:13px;color:#333}
.inline-edit-modal-content textarea{width:100%;padding:12px;border:1px solid #e0e0e0;border-radius:8px;font-family:inherit;font-size:14px;resize:vertical;line-height:1.5}
.inline-edit-modal-content textarea:focus{outline:none;border-color:#111;box-shadow:0 0 0 2px rgba(0,0,0,.05)}
.inline-edit-modal-buttons{display:flex;gap:10px;margin-top:24px}
.inline-edit-hint{font-size:12px;color:#888;margin:12px 0 0;line-height:1.6;padding:10px;background:#f9f9f9;border-radius:6px}

/* Footer */
.footer{background:transparent;margin-top:auto; padding-top:54px;}
.footer .line{height:1px;background:var(--border)}
.footer .copy{padding:10px 0 24px 0;font-size:12px;color:#808080;text-align:center;background:transparent}

/* Modal (slideshow) */
.modal{position:fixed;inset:0;display:none;align-items:center;justify-content:center;flex-direction:column;background:rgba(0,0,0,.92);padding:24px;z-index:1000}
.modal.show{display:flex}
.modal .stage{width:min(1100px, 92vw);height:min(85vh, 92vw);border-radius:12px;position:relative;overflow:hidden;background:transparent;padding:0;
              display:flex; align-items:center; justify-content:center;}
.modal .stage .lb-img{position:absolute;display:block;width:100%;height:100%;object-fit:contain;object-position:center;background:transparent;
                      opacity:0; transform:translateX(0); transition:opacity .28s ease, transform .28s ease;}
.modal .stage .lb-img.active{opacity:1; transform:translateX(0)}
.modal .stage .lb-img.enter-right{opacity:0; transform:translateX(40px)}
.modal .stage .lb-img.enter-left{opacity:0; transform:translateX(-40px)}
.modal .stage .lb-img.leave-left{opacity:0; transform:translateX(-40px)}
.modal .stage .lb-img.leave-right{opacity:0; transform:translateX(40px)}
.modal .index{position:static;margin-top:16px;color:#fff;text-align:center;font-size:12px;opacity:.9}
.modal .btn{display:flex;align-items:center;justify-content:center;border:1px solid rgba(255,255,255,.65);background:rgba(0,0,0,.25);color:#fff;border-radius:999px;width:48px;height:48px;font-weight:500;font-size:22px;cursor:pointer;opacity:.9}
.modal .btn:hover{opacity:1}
.modal .close{position:fixed;top:18px;left:18px;width:44px;height:44px;font-size:18px;border:1px solid rgba(255,255,255,.6)}
.modal .arrow.left{position:fixed;left:18px;top:50%;transform:translateY(-50%)}
.modal .arrow.right{position:fixed;right:18px;top:50%;transform:translateY(-50%)}

/* Responsive */
@media (max-width: 720px){
  .container{padding:16px}
  .grid-cards{grid-template-columns:1fr}
  .grid-thumbs{grid-template-columns:1fr !important}
  .project-image-row{grid-template-columns:1fr !important}
}
@media (max-width: 440px){
  .grid-gallery{grid-template-columns:1fr !important}
}

/* Style floating button */
.style-floating-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 24px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 999;
  transition: all 0.2s ease;
}
.style-floating-btn:hover {
  background: #333;
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
  transform: translateY(-2px);
}

/* Style panel */
#style-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background: #fff;
  border-left: 1px solid #e6e6e6;
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.1);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.3s ease;
  overflow-x: hidden;
}
#style-panel .editor-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
#style-panel .editor-content::-webkit-scrollbar {
  width: 8px;
}
#style-panel .editor-content::-webkit-scrollbar-track {
  background: #f5f5f5;
}
#style-panel .editor-content::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}
#style-panel .editor-content::-webkit-scrollbar-thumb:hover {
  background: #999;
}
#style-panel .form-group {
  margin-bottom: 16px;
}
#style-panel .style-section-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0;
}
#style-panel .style-section-content.open {
  max-height: 2000px;
  padding: 16px 0 0 0;
}
#style-panel .style-section-content select,
#style-panel .style-section-content input {
  width: 100%;
  box-sizing: border-box;
}
#style-panel .toggle-icon {
  transition: transform 0.3s ease;
}
#style-panel .style-section-header:hover {
  background: #ebebeb;
}
#style-panel .style-subsection-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0;
}
#style-panel .style-subsection-content.open {
  max-height: 2000px;
  padding: 12px 0 0 0;
}
#style-panel .toggle-icon-sub {
  transition: transform 0.3s ease;
}
#style-panel .style-subsection-header:hover {
  background: #f0f0f0;
}

/* Toast notifications */
.toast-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 10000;
  animation: slideInRight 0.3s ease-out;
  max-width: 300px;
  width: fit-content;
  height: fit-content;
  display: inline-block;
  word-wrap: break-word;
}
.toast-notification.success {
  background: #10b981;
  color: white;
}
.toast-notification.error {
  background: #ef4444;
  color: white;
}
@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Page Manager */
.add-page-btn {
  padding: 14px 24px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: all 0.2s ease;
  margin-left: 8px;
}
.add-page-btn:hover {
  background: #333;
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
  transform: translateY(-2px);
}

.delete-page-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  background: #dc3545;
  color: white;
  border: 2px solid white;
  border-radius: 50%;
  font-size: 14px;
  line-height: 16px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.nav a:hover .delete-page-btn {
  display: flex;
}
.delete-page-btn:hover {
  background: #c82333;
}

.page-manager-dialog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.page-manager-content {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.page-manager-content .form-group {
  margin-bottom: 16px;
}


/* System admin shell */
.admin-shell-toggle{position:fixed;right:14px;bottom:14px;z-index:2500;width:40px;height:40px;border-radius:999px;border:1px solid rgba(0,0,0,.12);background:rgba(255,255,255,.9);backdrop-filter:blur(8px);cursor:pointer;box-shadow:0 6px 22px rgba(0,0,0,.12);display:flex;align-items:center;justify-content:center;font-size:18px;color:#111}
.admin-shell-panel{position:fixed;right:14px;bottom:62px;z-index:2499;width:min(380px,calc(100vw - 28px));max-height:min(78vh,760px);overflow:auto;background:#fff;border:1px solid #e6e6e6;border-radius:16px;box-shadow:0 16px 40px rgba(0,0,0,.16);padding:14px}
.admin-shell-panel .admin-shell-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.admin-shell-panel .admin-shell-btn,.admin-shell-panel .admin-shell-danger{width:100%;padding:12px 14px;border-radius:12px;border:1px solid #ddd;background:#fafafa;cursor:pointer;text-align:left;font:inherit}
.admin-shell-panel .admin-shell-danger{background:#fff7f7;border-color:#f0c9c9}
.admin-shell-panel h4{margin:0 0 10px 0;font-size:14px}
.admin-shell-panel p{margin:0 0 12px 0;color:#666;font-size:12px;line-height:1.45}
.menu-manager-panel{position:fixed;top:0;right:0;width:min(460px,92vw);height:100vh;background:#fff;z-index:2600;border-left:1px solid #e6e6e6;box-shadow:-8px 0 28px rgba(0,0,0,.12);display:flex;flex-direction:column}
.menu-manager-panel .editor-content{padding:18px;overflow:auto}
.menu-manager-row{border:1px solid #e8e8e8;border-radius:12px;padding:12px;margin-bottom:12px;background:#fafafa}
.menu-manager-row .row-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
.menu-manager-row input,.menu-manager-row select{width:100%;box-sizing:border-box;padding:8px 10px;border:1px solid #d9d9d9;border-radius:8px;font:inherit}
.menu-manager-row label{display:block;margin:0 0 6px;font-size:12px;color:#444;font-weight:600}
.menu-manager-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.menu-manager-inline{display:flex;gap:8px;align-items:center}
.menu-manager-inline > *{flex:1}
.menu-manager-section{margin-bottom:20px;padding-bottom:18px;border-bottom:1px solid #eee}
.topbar .nav{background:var(--menu-bar-bg,transparent);border:1px solid var(--menu-bar-border,transparent);border-radius:var(--menu-bar-radius,0);padding:var(--menu-bar-pad-y,0) var(--menu-bar-pad-x,0);gap:var(--menu-gap,10px)}
.nav,.lang-toggle,.lang-btn,.topbar a,.topbar button{font-family:var(--font-ui, var(--font-family))}
:where(h1,h2,h3,h4,h5,h6), .label, .caption{font-family:var(--font-heading, var(--font-family))}
.project-text,.project-text-block,#page-desc,body{font-family:var(--font-body, var(--font-family))}
.modal .btn{font-family:system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI Symbol', 'Apple Symbols', sans-serif}
body.thumb-home-portrait .card{aspect-ratio:3/4}
body.thumb-home-landscape .card{aspect-ratio:16/10}
body.thumb-home-contain-width .card, body.thumb-home-auto .card{aspect-ratio:auto}
body.thumb-home-contain-width .card img, body.thumb-home-auto .card img{width:100%;height:auto;object-fit:contain}
body.thumb-home-contain-height .card{height:var(--card-height,420px);aspect-ratio:auto;display:flex;align-items:center;justify-content:center}
body.thumb-home-contain-height .card img{width:auto;height:100%;object-fit:contain}
body.thumb-cat-portrait #category-grid .thumb{aspect-ratio:3/4}
body.thumb-cat-landscape #category-grid .thumb{aspect-ratio:16/10}
body.thumb-cat-contain-width #category-grid .thumb, body.thumb-cat-auto #category-grid .thumb{aspect-ratio:auto}
body.thumb-cat-contain-width #category-grid .thumb img, body.thumb-cat-auto #category-grid .thumb img{width:100%;height:auto;object-fit:contain}
body.thumb-cat-contain-height #category-grid .thumb{height:var(--thumb-height,360px);aspect-ratio:auto;display:flex;align-items:center;justify-content:center}
body.thumb-cat-contain-height #category-grid .thumb img{width:auto;height:100%;object-fit:contain}
body.thumb-prj-portrait #project-content .thumb{aspect-ratio:3/4}
body.thumb-prj-landscape #project-content .thumb{aspect-ratio:16/10}
body.thumb-prj-contain-width #project-content .thumb, body.thumb-prj-auto #project-content .thumb{aspect-ratio:auto}
body.thumb-prj-contain-width #project-content .thumb img, body.thumb-prj-auto #project-content .thumb img{width:100%;height:auto;object-fit:contain}
body.thumb-prj-contain-height #project-content .thumb{height:var(--thumb-height,360px);aspect-ratio:auto;display:flex;align-items:center;justify-content:center}
body.thumb-prj-contain-height #project-content .thumb img{width:auto;height:100%;object-fit:contain}


.rte-wrap{margin-top:8px}
.rte-toolbar{display:flex;flex-wrap:wrap;gap:8px;padding:10px;border:1px solid #e0e0e0;border-bottom:none;border-radius:8px 8px 0 0;background:#f8f8f8}
.rte-btn,.rte-select{padding:7px 10px;border:1px solid #d7d7d7;border-radius:6px;background:#fff;color:#111;font:inherit;font-size:13px}
.rte-btn{cursor:pointer}
.rte-editor{min-height:160px;padding:12px;border:1px solid #e0e0e0;border-radius:0 0 8px 8px;background:#fff;line-height:1.6;overflow:auto}
.rte-editor:focus{outline:none;border-color:#bdbdbd}
.rte-editor a{color:#0a58ca;text-decoration:underline}


/* Project image captions: show on hover over gradient, allow a few lines before truncating */
#project-content .project-image-row,
#project-content{
  justify-content:center;
}
#project-content .project-image-row > .project-image-block,
#project-content > .thumb{
  margin-left:0;
  margin-right:0;
}
#project-content[data-item-count="1"] > .thumb,
#project-content .project-image-row[data-item-count="1"] > .project-image-block,
#project-content .project-image-row[data-image-count="1"] > .project-image-block{
  width:min(100%, 640px);
  flex-basis:min(100%, 640px);
  max-width:min(100%, 640px);
  margin-left:auto;
  margin-right:auto;
}
#project-content .project-image-block .caption,
#project-content > .thumb .caption{
  left:50%;
  top:auto;
  bottom:0;
  transform:translateX(-50%);
  width:calc(100% - 24px);
  max-width:calc(100% - 24px);
  box-sizing:border-box;
  padding:12px 12px 12px;
  min-height:calc(1.45em * 3 + 24px);
  max-height:calc(1.45em * 4 + 24px);
  white-space:normal;
  text-align:center;
  line-height:1.45;
  overflow:hidden;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  word-break:break-word;
}
#project-content .project-image-block:hover .caption,
#project-content > .thumb:hover .caption,
#project-content .project-image-block:focus-within .caption,
#project-content > .thumb:focus-within .caption{
  opacity:1;
}
#project-content .project-image-block:hover::before,
#project-content > .thumb:hover::before,
#project-content .project-image-block:focus-within::before,
#project-content > .thumb:focus-within::before{
  opacity:1;
}


/* Touch devices: project captions only inside slideshow */
body.touch-device #project-content .project-image-block .caption,
body.touch-device #project-content > .thumb .caption,
body.touch-device #project-content .project-image-row .caption{
  opacity:0 !important;
  display:none !important;
  pointer-events:none !important;
}
body.touch-device #project-content .project-image-block::before,
body.touch-device #project-content > .thumb::before,
body.touch-device #project-content .project-image-row .thumb::before{
  opacity:0 !important;
}
body.touch-device #project-content .project-image-block:hover .caption,
body.touch-device #project-content > .thumb:hover .caption,
body.touch-device #project-content .project-image-row .thumb:hover .caption,
body.touch-device #project-content .project-image-block:focus-within .caption,
body.touch-device #project-content > .thumb:focus-within .caption,
body.touch-device #project-content .project-image-row .thumb:focus-within .caption{
  opacity:0 !important;
  display:none !important;
}

/* Lightbox caption */
.modal .lb-caption{
  position:fixed;
  left:50%;
  bottom:22px;
  transform:translateX(-50%);
  width:min(880px, calc(100vw - 120px));
  max-height:28vh;
  overflow:auto;
  color:#fff;
  text-align:center;
  line-height:1.55;
  padding:12px 16px;
  background:rgba(0,0,0,.42);
  border:1px solid rgba(255,255,255,.18);
  border-radius:12px;
  backdrop-filter:blur(6px);
  z-index:3;
}
.modal .lb-caption.is-empty{display:none}
.modal .lb-caption p{margin:0 0 .8em 0}
.modal .lb-caption p:last-child{margin-bottom:0}
@media (max-width: 720px){
  .modal .lb-caption{
    width:calc(100vw - 32px);
    bottom:18px;
    max-height:32vh;
    padding:10px 12px;
  }
}


@media (max-width: 720px){
  .modal{
    padding:0;
    background:rgba(0,0,0,.96);
  }
  .modal .stage{
    width:100vw;
    height:100vh;
    border-radius:0;
    max-width:none;
    max-height:none;
  }
  .modal .stage .lb-img{
    width:100%;
    height:100%;
    object-fit:contain;
  }
  .modal .btn{
    width:36px;
    height:36px;
    font-size:17px;
    border-width:1px;
    background:rgba(0,0,0,.38);
  }
  .modal .close{
    top:10px;
    left:auto;
    right:10px;
    width:36px;
    height:36px;
    font-size:16px;
  }
  .modal .arrow.left{left:10px;}
  .modal .arrow.right{right:10px;}
  .modal .index{
    position:fixed;
    top:14px;
    left:14px;
    margin-top:0;
    font-size:11px;
    text-align:left;
    z-index:3;
  }
  .modal .lb-caption{
    width:calc(100vw - 24px);
    bottom:12px;
    max-height:28vh;
    padding:10px 12px;
    border-radius:10px;
  }
}


/* Mobile/touch project galleries: captions only in slideshow, not on thumbs */
@media (hover: none), (pointer: coarse), (max-width: 768px){
  #project-content .project-image-block .caption,
  #project-content > .thumb .caption,
  #project-content .project-image-row .caption{
    opacity:0 !important;
    display:none !important;
    pointer-events:none !important;
  }
  #project-content .project-image-block::before,
  #project-content > .thumb::before,
  #project-content .project-image-row .thumb::before{
    opacity:0 !important;
  }
  #project-content .project-image-block:hover .caption,
  #project-content > .thumb:hover .caption,
  #project-content .project-image-row .thumb:hover .caption,
  #project-content .project-image-block:focus-within .caption,
  #project-content > .thumb:focus-within .caption,
  #project-content .project-image-row .thumb:focus-within .caption{
    opacity:0 !important;
    display:none !important;
  }

  .modal{
    padding:0;
    background:rgba(0,0,0,.98);
  }
  .modal .stage{
    width:100vw;
    height:100vh;
    max-width:100vw;
    max-height:100vh;
    border-radius:0;
  }
  .modal .stage .lb-img{
    width:100vw;
    height:100vh;
    max-width:100vw;
    max-height:100vh;
    object-fit:contain;
    object-position:center center;
  }
  .modal .btn{
    width:28px;
    height:28px;
    font-size:13px;
    background:rgba(0,0,0,.42);
    border-color:rgba(255,255,255,.42);
  }
  .modal .close{
    top:8px;
    right:8px;
    left:auto;
    width:28px;
    height:28px;
    font-size:13px;
  }
  .modal .arrow.left{left:8px;}
  .modal .arrow.right{right:8px;}
  .modal .index{
    top:10px;
    left:10px;
    font-size:10px;
  }
  .modal .lb-caption{
    width:calc(100vw - 20px);
    bottom:8px;
    max-height:34vh;
    padding:10px 12px;
    border-radius:10px;
    background:rgba(0,0,0,.5);
  }
}


/* Final mobile slideshow overrides: true fullscreen stage, overlay controls, captions only inside slideshow */
@media (hover: none), (pointer: coarse), (max-width: 768px){
  #project-content .thumb .caption,
  #project-content .project-image-block .caption,
  #project-content .project-image-row .thumb .caption{
    display:none !important;
    opacity:0 !important;
    visibility:hidden !important;
    pointer-events:none !important;
  }

  .modal{
    padding:0 !important;
    display:none;
    background:rgba(0,0,0,.985) !important;
  }
  .modal.show{
    display:block !important;
  }
  .modal .stage{
    position:fixed !important;
    inset:0 !important;
    width:100vw !important;
    height:100vh !important;
    max-width:none !important;
    max-height:none !important;
    border-radius:0 !important;
    overflow:hidden !important;
    display:block !important;
    flex:none !important;
    margin:0 !important;
    z-index:1;
  }
  .modal .stage .lb-img{
    position:absolute !important;
    inset:0 !important;
    width:100vw !important;
    height:100vh !important;
    max-width:none !important;
    max-height:none !important;
    object-fit:contain !important;
    object-position:center center !important;
    margin:0 !important;
  }
  .modal .btn{
    position:fixed !important;
    z-index:4 !important;
    width:34px !important;
    height:34px !important;
    min-width:34px !important;
    min-height:34px !important;
    border-radius:999px !important;
    border:1px solid rgba(255,255,255,.42) !important;
    background:rgba(0,0,0,.38) !important;
    backdrop-filter:blur(2px);
    font-size:14px !important;
    line-height:1 !important;
  }
  .modal .close{
    top:max(8px, env(safe-area-inset-top)) !important;
    right:max(8px, env(safe-area-inset-right)) !important;
    left:auto !important;
  }
  .modal .arrow.left{
    left:max(8px, env(safe-area-inset-left)) !important;
    top:50% !important;
    transform:translateY(-50%) !important;
  }
  .modal .arrow.right{
    right:max(8px, env(safe-area-inset-right)) !important;
    top:50% !important;
    transform:translateY(-50%) !important;
  }
  .modal .index{
    position:fixed !important;
    top:max(10px, env(safe-area-inset-top)) !important;
    left:max(10px, env(safe-area-inset-left)) !important;
    margin:0 !important;
    z-index:4 !important;
    font-size:10px !important;
    opacity:.82 !important;
  }
  .modal .lb-caption{
    position:fixed !important;
    left:50% !important;
    bottom:max(10px, env(safe-area-inset-bottom)) !important;
    transform:translateX(-50%) !important;
    width:calc(100vw - 20px) !important;
    max-width:none !important;
    max-height:30vh !important;
    padding:10px 12px !important;
    border-radius:10px !important;
    background:linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,.48)) !important;
    border:1px solid rgba(255,255,255,.14) !important;
    z-index:4 !important;
    overflow:auto !important;
  }
}


/* Hide floating language switch while slideshow is open */
body.modal-open .lang-toggle{
  opacity:0 !important;
  pointer-events:none !important;
  visibility:hidden !important;
}

/* Slideshow UI can be toggled by tapping/clicking the image center */
.modal.ui-hidden .btn,
.modal.ui-hidden .index,
.modal.ui-hidden .lb-caption{
  opacity:0 !important;
  pointer-events:none !important;
  visibility:hidden !important;
}

.modal .btn,
.modal .index,
.modal .lb-caption,
.lang-toggle{
  transition:opacity .18s ease, visibility .18s ease;
}


@media (min-width: 1025px){
  body.thumb-prj-contain-height #project-content > .thumb.equal-height-active,
  body.thumb-prj-contain-height #project-content .project-image-row > .thumb.equal-height-active,
  body.thumb-prj-contain-height #project-content .project-image-row > .project-image-block.equal-height-active,
  #project-content > .thumb.display-contain-height.equal-height-active,
  #project-content .project-image-row > .thumb.display-contain-height.equal-height-active,
  #project-content .project-image-row > .project-image-block.display-contain-height.equal-height-active{
    width:var(--fit-height-width) !important;
    flex:0 0 var(--fit-height-width) !important;
    max-width:none !important;
  }

  body.thumb-prj-contain-height #project-content > .thumb.equal-height-active img,
  body.thumb-prj-contain-height #project-content .project-image-row > .thumb.equal-height-active img,
  body.thumb-prj-contain-height #project-content .project-image-row > .project-image-block.equal-height-active img,
  #project-content > .thumb.display-contain-height.equal-height-active img,
  #project-content .project-image-row > .thumb.display-contain-height.equal-height-active img,
  #project-content .project-image-row > .project-image-block.display-contain-height.equal-height-active img{
    width:auto !important;
    height:100% !important;
    max-width:none !important;
    object-fit:contain !important;
  }
}


/* Equal-height project rows: final desktop override */
@media (min-width: 1025px){
  #project-grid.equal-height-container,
  .project-image-row.equal-height-container{
    display:flex !important;
    flex-wrap:wrap !important;
    gap:var(--gap) !important;
    justify-content:center !important;
    align-items:flex-start !important;
  }

  #project-content > .thumb.equal-height-active,
  #project-content .project-image-row > .project-image-block.equal-height-active,
  #project-grid > .thumb.equal-height-active,
  #project-grid .project-image-row > .project-image-block.equal-height-active,
  .project-image-row.equal-height-container > .thumb.equal-height-active,
  .project-image-row.equal-height-container > .project-image-block.equal-height-active{
    width:var(--fit-height-width) !important;
    flex:0 0 var(--fit-height-width) !important;
    max-width:none !important;
    min-width:0 !important;
  }

  #project-content > .thumb.equal-height-active img,
  #project-content .project-image-row > .project-image-block.equal-height-active img,
  #project-grid > .thumb.equal-height-active img,
  #project-grid .project-image-row > .project-image-block.equal-height-active img,
  .project-image-row.equal-height-container > .thumb.equal-height-active img,
  .project-image-row.equal-height-container > .project-image-block.equal-height-active img{
    width:auto !important;
    height:100% !important;
    max-width:none !important;
    object-fit:contain !important;
  }
}
