/* LAYERED TEMPLATES (owner, Oct 8): photo frames, the photo window, the
   colour sets and the QR code. js/frames.js draws them. */

/* The picture includes its bleed. In the trimmed view it is cut away exactly
   as the press cuts it, so the typeset words sit on it where they will print
   (--lb-x / --lb-y: the bleed as a share of the trim, set by js/frames.js). */
.doc.is-layered[data-view="trim"] .doc__img {
  /* an image is a REPLACED element: width:auto would mean its own pixel size,
     so the box is sized explicitly — the card plus the bleed on every side */
  inset: auto;
  left: calc(-1 * var(--lb-x, 0%));
  top: calc(-1 * var(--lb-y, 0%));
  width: calc(100% + 2 * var(--lb-x, 0%));
  height: calc(100% + 2 * var(--lb-y, 0%));
}

/* the frames sit over the picture, under the logos and the words */
.framelayer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}
.framehit {
  fill: transparent;
  stroke: transparent;
  stroke-width: 2px;
  vector-effect: non-scaling-stroke;
  pointer-events: fill;
  cursor: pointer;
  transition: stroke .12s ease, fill .12s ease;
}
.framehit:hover { stroke: rgba(255, 255, 255, .9); fill: rgba(255, 255, 255, .06); }
.framehit:focus-visible { outline: none; stroke: var(--accent); stroke-dasharray: 6 4; }
.framehit.is-selected {
  stroke: var(--accent);
  stroke-dasharray: 6 4;
  cursor: grab;
}
.framehit.is-selected:active { cursor: grabbing; }
.framehit.is-empty { fill: rgba(255, 255, 255, .14); }
.framehit--qr.is-selected { cursor: pointer; }

/* nothing prints at the QR code until it has a link: said on screen only */
.qrhint rect { fill: rgba(255, 255, 255, .92); stroke: var(--accent); stroke-width: 1.5px; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.qrhint text { fill: var(--muted); font-family: var(--font-ui, system-ui, sans-serif); font-weight: 600; }

/* ---------- the photo window (the Text window's look) ---------- */
.photowin__row { display: flex; flex-wrap: wrap; gap: 8px; }
.photowin__btn {
  flex: 1 1 auto;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.photowin__btn:hover:not([aria-disabled="true"]) { border-color: var(--accent-line); background: var(--accent-soft); }
.photowin__btn--main { background: var(--accent); border-color: var(--accent); color: #fff; }
.photowin__btn--main:hover:not([aria-disabled="true"]) { background: var(--accent); filter: brightness(1.06); color: #fff; }
.photowin__status {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
}
.photowin__thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.photowin__thumb {
  width: 56px;
  height: 56px;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
}
.photowin__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photowin__thumb[aria-pressed="true"] { border-color: var(--accent); }
.photowin__thumb:hover:not([aria-disabled="true"]) { border-color: var(--accent-line); }
.photowin__draft { display: grid; gap: 8px; margin-top: 10px; }
.photowin__prompt {
  width: 100%;
  min-height: 64px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--paper);
  resize: vertical;
}
.photowin__prompt:focus { outline: 2px solid var(--accent-line); outline-offset: 1px; }
.photowin__quality { margin: 0; font-size: 12px; line-height: 1.35; }
.photowin__quality--sharp, .photowin__quality--good { color: var(--muted); }
.photowin__quality--soft { color: #9A6B12; }
.photowin__quality--tiny { color: #B23A2E; }
.photowin__foot { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.photowin__plain { color: var(--ink); }
.photowin__radios { display: grid; gap: 8px; margin-bottom: 10px; }
.photowin__radio { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 8px; font-size: 13px; color: var(--ink); cursor: pointer; }
.photowin__radio input { margin: 0; accent-color: var(--accent); }
.photowin__link {
  grid-column: 2;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 13px;
  background: var(--paper);
  color: var(--ink);
}
.photowin [aria-disabled="true"] { opacity: .5; cursor: progress; }

/* ---------- the colour sets, under the card ---------- */
.themebar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: var(--shadow-soft, 0 1px 2px rgba(0, 0, 0, .06));
}
.themebar[hidden] { display: none; }
.themebar__label { font-size: 12px; font-weight: 600; color: var(--muted); margin-right: 2px; }
.themebar__set {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 32px;
  padding: 4px 6px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}
.themebar__set:hover { background: var(--accent-soft); }
.themebar__set[aria-pressed="true"] { border-color: var(--accent); }
.themebar__set:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.themebar__dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .12); }

/* ---------- add text in the design's own style ---------- */
.addtextrow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.addtextrow:has(> #addTextBtn:only-child) { display: block; }
.addtextrow__label { grid-column: 1 / -1; margin: 0; }
.addtextbtn--style { text-align: left; }
.addtextbtn__sample { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addtextbtn--headline .addtextbtn__sample { font-size: 15px; }
.addtextbtn--subheading .addtextbtn__sample { font-size: 13.5px; }
.addtextbtn--body .addtextbtn__sample, .addtextbtn--small .addtextbtn__sample { font-size: 12.5px; }

/* the font list: the design's own faces first */
.fontpop__group--used { color: var(--accent); }
