/* galerii-toode — client gallery (ported from kerlilaas.com/galerii, de-branded).
   Neutral product skin: system fonts (no external font requests — EU/GDPR pitch).
   Palette tokens live in theme.css (loaded first) — change sage THERE, once. */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}
h1 {
  font-weight: 400;
  font-size: clamp(24px, 4vw, 36px);
  letter-spacing: .01em;
}
h2 { font-weight: 500; font-size: 20px; }
.brand {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--mut);
  margin-bottom: .4rem;
}
a { color: var(--accent-ink); }
.meta { color: var(--mut); font-size: 14px; margin-top: .3rem; }
.meta.pend { font-style: italic; }

/* buttons */
.btn {
  display: inline-block;
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--ink);
  border-radius: 3px;
  padding: .7em 1.3em;
  cursor: pointer;
  transition: all .15s;
}
.btn:hover { background: var(--ink); color: #fff; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(.88); }
.btn.ghost { border-color: var(--line); color: var(--mut); background: #fff; }
.btn.ghost:hover { background: #f4f4f5; color: var(--ink); }
.btn.tiny { font-size: 11px; padding: .45em .9em; }
.btn:disabled { opacity: .55; cursor: default; }

/* header bars */
.bar, .ghead { padding: clamp(18px, 4vw, 40px) clamp(14px, 4vw, 48px); }
.bar {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.ghead { text-align: center; }

/* panel: settings | selection on top, publish | downloads underneath —
   every edge sits on the same two vertical lines */
.panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 330px));
  justify-content: center; align-items: start;
  gap: 22px clamp(24px, 4vw, 48px);
  margin-top: 20px;
  text-align: left;
  width: 100%;
}
@media (max-width: 680px) {
  .panel { grid-template-columns: min(330px, 100%); }
}
.ctrls { display: flex; flex-direction: column; gap: 12px; align-self: center; }
.ctrl-lbl {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase; color: var(--ink);
}
.editrow, .sizerow {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.sizebtns { display: flex; gap: 6px; }
.sizerow .ctrl-lbl svg { color: var(--accent-ink); }
.ghead .sizerow { justify-content: center; margin-top: 12px; }
.sizebtn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid var(--line); background: #fff; color: #b5b5b8;
  cursor: pointer; border-radius: 4px;
}
.sizebtn:hover { color: var(--ink); }
.sizebtn.on { border-color: var(--ink); color: var(--ink); background: #f4f4f5; }

/* selection box */
.selbox { display: flex; flex-direction: column; gap: 10px; }
.selhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #f3f5f4; border: 1px solid var(--line); border-radius: 999px;
  padding: .35em .95em; font-size: 14px; font-weight: 600; color: var(--ink);
}
.chip::before {
  content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--heart);
}
.onlysel {
  font: inherit; font-size: 13px; color: var(--mut);
  background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: .35em .9em; cursor: pointer;
}
.onlysel:hover { color: var(--ink); }
.onlysel[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.snapnote { font-size: 12px; color: var(--mut); }

/* publish */
.pubarea { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.pubarea .btn { text-align: center; }
.pubarea .pubnote { margin-bottom: 2px; }
.shared { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.shared .pubnote { margin: 0; }
.pubnote { font-size: 14px; color: var(--mut); margin-bottom: .5rem; font-style: italic; }
.pubnote.ok { color: var(--accent-ink); font-style: normal; font-weight: 700; }
.sharerow { display: flex; gap: 8px; }
.sharerow input {
  flex: 1; min-width: 180px;
  font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink);
  border: 1px solid var(--line); border-radius: 3px; padding: .6em .8em; background: #fafafa;
}

/* downloads */
.dlbox { display: flex; flex-direction: column; gap: 8px; }
.btn.dl {
  display: inline-flex; align-items: center; gap: 12px;
  background: var(--ink); border-color: var(--ink); color: #fff;
  padding: .8em 1.4em;
  text-transform: none; letter-spacing: .01em;
  font-size: 16px; font-weight: 500;
}
.btn.dl:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.dl.light { background: #fff; color: var(--ink); }
.btn.dl.light:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dl > span { display: flex; flex-direction: column; text-align: left; line-height: 1.3; }
.btn.dl small {
  font-size: 11px; font-weight: 600; opacity: .72;
  text-transform: uppercase; letter-spacing: .12em;
}

/* the private-view notice — same accent "system layer" as the guest preview banner */
.hint {
  background: var(--accent); margin: 0;
  padding: 15px clamp(14px, 4vw, 48px);
  text-align: center;
}
.hint span {
  display: inline-block; max-width: 960px;
  font-size: 15px; color: #fff; line-height: 1.55;
}
.hint strong { color: #fff; }
.empty { text-align: center; color: var(--mut); padding: 40px 20px; font-style: italic; }

/* justified grid: flex-grow proportional to aspect ratio, row height via --rowh */
.g { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; --rowh: 320px; }
body[data-thumbsize="s"] .g { --rowh: 230px; }
body[data-thumbsize="l"] .g { --rowh: 440px; }
.g::after { content: ''; flex-grow: 1000000; }
.it {
  position: relative;
  aspect-ratio: var(--ar);
  flex-grow: calc(var(--ar) * 100);
  flex-basis: calc(var(--ar) * var(--rowh));
  overflow: hidden;
  cursor: zoom-in;
  background: #f2f2f3;
}
.it img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .2s; }
.it.hid img { opacity: .3; }
.it.hid::before {
  content: 'PEIDETUD';
  position: absolute; inset: auto 0 0 0; z-index: 1;
  font-size: 11px; font-weight: 600; letter-spacing: .2em;
  text-align: center; padding: 3px 0;
  background: rgba(28,28,30,.75); color: #fff;
}
/* "ainult valitud" filter */
body.only-sel .it:not(.sel) { display: none; }

/* hide-mode: eyes + dimming only while choosing; "enjoy" mode keeps a soft ribbon */
body:not(.edit) .eye { display: none; }
body:not(.edit) .it.hid img { opacity: .85; }
body:not(.edit) .it.hid::before { opacity: .75; }
.editrow { cursor: pointer; user-select: none; }
.switch {
  flex: none; width: 54px; height: 30px; border-radius: 15px;
  border: 1px solid var(--line); background: #d8d8da;
  position: relative; cursor: pointer; padding: 0;
  transition: background .2s;
}
.switch .knob {
  position: absolute; top: 2px; left: 2px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35);
  transition: left .2s;
}
body.edit .switch { background: var(--accent); border-color: var(--accent); }
body.edit .switch .knob { left: 26px; }
.editrow svg .closed { display: none; }
body.edit .editrow svg .closed { display: block; }
body.edit .editrow svg .open { display: none; }
.editrow svg { color: var(--mut); }
body.edit .editrow svg { color: var(--accent-ink); }

/* per-photo buttons: eye top-right (hide from guests), heart bottom-left (selection) */
.eye, .heart {
  position: absolute; z-index: 2;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%;
  background: rgba(255,255,255,.88); color: var(--ink);
  cursor: pointer;
}
.eye { top: 8px; right: 8px; }
.heart { bottom: 8px; left: 8px; color: var(--ink); }
.it.hid .heart { bottom: 30px; }            /* clear the PEIDETUD ribbon */
.eye:hover, .heart:hover { background: #fff; }
.heart:active { transform: scale(.9); }
.eye svg .closed { display: none; }
.it.hid .eye { background: var(--accent); color: #fff; }
.it.hid .eye svg .open { display: none; }
.it.hid .eye svg .closed { display: block; }
.it.sel .heart { background: var(--heart); color: #fff; }
.it.sel .heart svg { fill: currentColor; }
.it.sel::after {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  box-shadow: inset 0 0 0 3px var(--heart);
}

/* live-save indicator */
.saveind[hidden] { display: none; }
.saveind {
  position: fixed; right: 14px; bottom: 14px; z-index: 40;
  background: rgba(28,28,30,.9); color: #fff;
  font-size: 13px; padding: .5em 1em; border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
  transition: opacity .2s;
}
.saveind.off { background: #8a6d3b; }

/* "Kinnita valik" result sheet */
.sheet[hidden] { display: none; }
.sheet {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(12,12,12,.6);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.sheetbox {
  position: relative;
  background: #fff; border-radius: 6px; padding: 26px;
  width: min(560px, 100%); max-height: 86vh; overflow: auto;
  display: flex; flex-direction: column; gap: 12px;
}
.sheet-x {
  position: absolute; top: 6px; right: 12px;
  border: 0; background: none; font-size: 30px; line-height: 1;
  color: var(--mut); cursor: pointer;
}
.sheetbox textarea {
  width: 100%; resize: vertical;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px solid var(--line); border-radius: 3px; padding: 10px; background: #fafafa;
}

/* lightbox */
.lb[hidden] { display: none; }
.lb {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(12,12,12,.96);
  display: flex; align-items: center; justify-content: center;
}
.lb img { max-width: 94vw; max-height: 84vh; object-fit: contain; }
.lb > button {
  position: absolute; border: 0; background: none; color: #fff;
  cursor: pointer; opacity: .7; transition: opacity .15s;
}
.lb > button:hover { opacity: 1; }
.lb-x { top: 10px; right: 16px; font-size: 40px; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); font-size: 64px; padding: 0 18px; }
.lb-prev { left: 0; } .lb-next { right: 0; }
.lb-bar {
  position: absolute; bottom: 14px; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  color: #bbb; font-size: 14px;
}
.lb-bar a.btn { border: 0; }
.lb-bar .lbheart {
  position: static; display: inline-flex; align-items: center; gap: 7px;
  border-color: rgba(255,255,255,.35); background: transparent; color: #fff; opacity: 1;
}
.lb-bar .lbheart:hover { background: rgba(255,255,255,.12); color: #fff; }
.lb-bar .lbheart.on { background: var(--heart); border-color: var(--heart); color: #fff; }
.lb-bar .lbheart.on svg { fill: currentColor; }

.previewbar {
  background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  text-align: center; padding: 9px 14px;
}
.previewbar a { color: #fff; }

/* photographer's own promo slot (guest view) */
.promo {
  border-top: 1px solid var(--line);
  margin-top: 30px; padding: 34px clamp(14px, 4vw, 48px);
  text-align: center; background: #fafafa;
}
.promo img { max-width: 100%; height: auto; }

/* messages / login */
.msg { max-width: 520px; margin: 12vh auto; padding: 0 20px; text-align: center; }
.msg h1 { margin-bottom: 1rem; }
.msg p { color: var(--mut); margin-bottom: 1.2rem; }
.login input {
  width: 100%; font: 17px var(--ui); text-align: center;
  border: 1px solid var(--line); border-bottom: 2px solid var(--ink);
  border-radius: 3px 3px 0 0;
  padding: .8em; margin-bottom: 1rem; background: #fafafa;
}
.pwrow { display: flex; gap: 10px; }
.pwrow input { min-width: 0; flex: 1; }
.login input:focus { outline: none; border-bottom-color: var(--accent); }
.login button { width: 100%; }
.login .btn, .login button {
  font-family: var(--ui); font-size: 14px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
  background: var(--accent); color: #fff; border: 0; border-radius: 3px;
  padding: .9em; cursor: pointer;
}
.login button:hover { filter: brightness(.88); }
.err { color: #c0392b; font-size: 14px; }

.foot { padding: 40px 20px 30px; text-align: center; font-size: 13px; color: var(--mut); }
.foot a { color: var(--mut); }

@media (max-width: 600px) {
  .g { --rowh: 200px; }
  body[data-thumbsize="s"] .g { --rowh: 140px; }
  body[data-thumbsize="l"] .g { --rowh: 280px; }
  .lb-prev, .lb-next { font-size: 44px; padding: 0 8px; }
  .eye, .heart { width: 40px; height: 40px; }
}

/* overage line under the selection chip (Valik with a package size) */
.over { font-size: 13px; font-weight: 600; color: var(--accent-ink); }
.over[hidden] { display: none; }
/* share button in the lightbox bar */
.lb-bar .lbshare { border-color: rgba(255,255,255,.35); background: transparent; color: #fff; opacity: 1; }
.lb-bar .lbshare:hover { background: rgba(255,255,255,.12); color: #fff; }
.lb-bar .lbshare[hidden] { display: none; }
/* single-photo share page */
body.photo main.single { padding: 0 clamp(14px, 4vw, 48px) 40px; text-align: center; }
body.photo main.single img { max-width: 100%; height: auto; max-height: 80vh; width: auto; margin: 0 auto; display: inline-block; }

/* sets: a header row inside the justified grid */
.gset { flex: 0 0 100%; width: 100%; margin: 0; padding: 30px 10px 10px; font-size: 12px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--mut); }
.gset small { font-weight: 400; letter-spacing: 0; margin-left: 6px; }
.g .gset:first-child { padding-top: 12px; }
body.only-sel .gset { display: none; }

/* slideshow button row in the header controls */
.ssrow { display: flex; justify-content: flex-end; }
.ghead .ssrow { justify-content: center; margin-top: 10px; }
/* comments panel inside the lightbox */
/* with the panel open the lightbox becomes a grid: image + bar on the left, panel on the right */
.lb.with-c { display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: minmax(0, 1fr) auto; }
.lb.with-c > img { grid-area: 1 / 1; place-self: center; max-width: 100%; max-height: 84vh; }
.lb.with-c .lb-bar { position: static; grid-area: 2 / 1; }
.lb.with-c .lbc { grid-area: 1 / 2 / 3 / 3; }
.lb.with-c .lb-x { right: 336px; }
.lb.with-c .lb-next { right: 320px; }
.lbc { width: 320px; max-width: 100vw; height: 100%; background: #fff; color: var(--ink); display: flex; flex-direction: column; }
.lbc[hidden] { display: none; }
.lbc-list { flex: 1; overflow: auto; padding: 18px 16px; }
.lbc-item { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.lbc-item b { font-weight: 600; }
.lbc-item span { color: var(--mut); font-size: 12px; margin-left: 6px; }
.lbc-item p { margin-top: 4px; white-space: pre-wrap; }
.lbc-empty { color: var(--mut); font-size: 14px; }
.lbc-form { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.lbc-form input, .lbc-form textarea { width: 100%; font: 14px/1.4 var(--ui); border: 1px solid var(--line); border-radius: 3px; padding: .6em .8em; background: #fafafa; color: var(--ink); }
.lbc-form textarea { resize: vertical; }
.lb-bar .lbcbtn { border-color: rgba(255,255,255,.35); background: transparent; color: #fff; opacity: 1; }
.lb-bar .lbcbtn:hover { background: rgba(255,255,255,.12); color: #fff; }
@media (max-width: 760px) {
  .lb.with-c { grid-template-columns: 1fr; grid-template-rows: minmax(0, 42vh) auto minmax(0, 1fr); }
  .lb.with-c > img { max-height: 42vh; }
  .lb.with-c .lb-bar { grid-area: 2 / 1; }
  .lb.with-c .lbc { grid-area: 3 / 1; width: 100%; height: auto; min-height: 0; }
  .lb.with-c .lb-x { right: 16px; } .lb.with-c .lb-next { right: 0; }
  .lb.with-c .lb-prev, .lb.with-c .lb-next { top: 21vh; }
}
/* slideshow overlay */
.ss[hidden] { display: none; }
.ss { position: fixed; inset: 0; z-index: 70; background: #000; }
.ss img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .9s ease; }
.ss img.show { opacity: 1; }
.ss-x { position: absolute; top: 10px; right: 16px; z-index: 2; border: 0; background: rgba(0,0,0,.35); color: #fff; font-size: 34px; line-height: 1; width: 48px; height: 48px; border-radius: 50%; cursor: pointer; }
.ss-bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px; color: #ddd; font-size: 13px; background: linear-gradient(transparent, rgba(0,0,0,.55)); }
.ss-b { border: 1px solid rgba(255,255,255,.35); background: transparent; color: #fff; width: 40px; height: 40px; border-radius: 50%; font-size: 20px; cursor: pointer; }
.ss-b:hover { background: rgba(255,255,255,.12); }
.ss-count { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }
.ss-speed select { font: inherit; color: #fff; background: transparent; border: 1px solid rgba(255,255,255,.35); border-radius: 3px; padding: 4px 6px; margin-left: 4px; }
.ss-speed select option { color: #000; }

/* couple: standalone on-state for switches outside the hide-mode body class */
.switch.on { background: var(--accent); border-color: var(--accent); }
.switch.on .knob { left: 26px; }
/* guest upload panel */
.gup { text-align: center; padding: 14px clamp(14px, 4vw, 48px) 4px; }
.gup summary { list-style: none; display: inline-block; cursor: pointer; }
.gup summary::-webkit-details-marker { display: none; }
.gup form { max-width: 420px; margin: 14px auto 0; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.gup input[type=text], .gup input:not([type]) { font: 15px var(--ui); border: 1px solid var(--line); border-radius: 3px; padding: .6em .8em; background: #fafafa; color: var(--ink); }
.gup input[type=file] { font: 14px var(--ui); }
.gup .note { font-size: 13px; color: var(--mut); margin: 0; }
/* guest photo label on thumbnails */
.byguest { position: absolute; left: 8px; top: 8px; z-index: 2; font-size: 11px; font-weight: 600; letter-spacing: .06em; padding: 3px 8px; border-radius: 2px; background: rgba(255,255,255,.88); color: var(--ink); }
