/* collection-tags.css -- tags on collection cards (app/js/collection-tags.js).
   --ctag / --ctag-ink come from the tag itself, so it looks the same in every
   theme. */
.ctag{
  background:var(--ctag); color:var(--ctag-ink); font-family:inherit; font-size:10.5px; font-weight:800; line-height:1;
  letter-spacing:.05em; text-transform:uppercase; white-space:nowrap;
}
.ctag-corner{ position:absolute; top:0; inset-inline-start:0; z-index:2; pointer-events:none; max-width:100%; }
.ctag-corner.is-end{ inset-inline-start:auto; inset-inline-end:0; }
.ctag-corner .ctag > span{ display:block; overflow:hidden; text-overflow:ellipsis; }

/* ribbon: a band across the corner */
.ctag-corner.is-ribbon{ width:130px; height:130px; overflow:hidden; transform-origin:top left; }
.ctag-ribbon{
  position:absolute; top:37px; left:-50px; width:200px; height:26px; padding:0 36px; box-sizing:border-box;
  display:flex; align-items:center; justify-content:center; transform:rotate(-45deg); box-shadow:0 3px 8px rgba(0,0,0,.28);
}
.ctag-corner.is-ribbon.is-end, [dir="rtl"] .ctag-corner.is-ribbon:not(.is-end){ transform-origin:top right; }
.ctag-corner.is-end .ctag-ribbon, [dir="rtl"] .ctag-corner:not(.is-end) .ctag-ribbon{ left:auto; right:-50px; transform:rotate(45deg); }
[dir="rtl"] .ctag-corner.is-ribbon.is-end{ transform-origin:top left; }
[dir="rtl"] .ctag-corner.is-end .ctag-ribbon{ right:auto; left:-50px; transform:rotate(-45deg); }

/* flag: flat against the edge, notched at its free end */
.ctag-corner.is-flag{ top:14px; filter:drop-shadow(0 2px 4px rgba(0,0,0,.25)); }
.ctag-flag{ display:block; padding:8px 22px 8px 12px; clip-path:polygon(0 0, 100% 0, calc(100% - 9px) 50%, 100% 100%, 0 100%); }
.ctag-corner.is-end .ctag-flag, [dir="rtl"] .ctag-corner:not(.is-end) .ctag-flag{ padding:8px 12px 8px 22px; clip-path:polygon(0 0, 100% 0, 100% 100%, 0 100%, 9px 50%); }
[dir="rtl"] .ctag-corner.is-end .ctag-flag{ padding:8px 22px 8px 12px; clip-path:polygon(0 0, 100% 0, calc(100% - 9px) 50%, 100% 100%, 0 100%); }

/* pill */
.ctag-corner.is-pill{ padding:10px; }
.ctag-pill{ display:inline-block; padding:6px 10px; border-radius:999px; box-shadow:0 2px 6px rgba(0,0,0,.18); }
.ctag-pills{ display:flex; flex-wrap:wrap; gap:5px; }
.ctag-pills .ctag-pill{ font-size:9.5px; padding:5px 8px; box-shadow:0 0 0 1px rgba(127,127,127,.25); }
.portal-collection-thumb > .ctag-pills, .ctag-preview > .ctag-pills{ position:absolute; z-index:2; inset-inline:10px; bottom:10px; pointer-events:none; }
.page-head .ctag-pills{ margin-top:8px; }
td .ctag-pills{ margin-top:4px; }
.cpd-band > .ctag-pills{ margin:0 0 14px; }
.coll-card-overlay .ctag-pills{ margin-bottom:8px; }

.ctag-dot{ display:inline-block; width:9px; height:9px; border-radius:50%; background:var(--ctag); margin-inline-end:6px; box-shadow:0 0 0 1px rgba(127,127,127,.35); }

@media (max-width:640px){
  .ctag-corner.is-ribbon{ transform:scale(.76); }
  .ctag-corner.is-flag{ top:10px; }
  .coll-card .ctag-corner.is-flag{ top:46px; } /* website: under the collection code */
  .coll-card .ctag-corner.is-pill{ top:36px; }
  .ctag-flag, .ctag-corner .ctag-pill{ font-size:9.5px; }
}

/* ---------- admin: button on the Shop card, tag editors ---------- */
.ctag-edit{
  position:absolute; z-index:3; top:8px; inset-inline-end:8px; display:inline-flex; align-items:center; gap:5px; padding:6px 10px;
  border:1px solid var(--line); border-radius:999px; background:var(--surface); color:var(--ink); font:inherit; font-size:11.5px; font-weight:650;
  cursor:pointer; opacity:0; transition:opacity .15s;
}
.portal-collection-card:hover .ctag-edit, .ctag-edit:focus-visible{ opacity:1; }
@media (hover:none){ .ctag-edit{ opacity:1; } }
.ctag-form{ display:grid; grid-template-columns:minmax(0,1fr) 250px; gap:20px; align-items:start; }
.ctag-preview{
  position:relative; aspect-ratio:16/9; border-radius:12px; overflow:hidden; background:var(--bg-soft); border:1px solid var(--line);
  display:flex; align-items:center; justify-content:center; color:var(--ink-faint);
}
.ctag-preview img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.ctag-swatches{ display:flex; flex-wrap:wrap; gap:7px; align-items:center; }
.ctag-swatch{ width:26px; height:26px; padding:0; border-radius:50%; border:2px solid var(--surface); background:var(--ctag); box-shadow:0 0 0 1px var(--line); cursor:pointer; }
.ctag-swatch.is-on{ box-shadow:0 0 0 2px var(--accent); }
.form-row .ctag-swatches input[type=color], .form-row .ctag-own input[type=color]{ width:38px; height:28px; padding:2px; border-radius:8px; cursor:pointer; }
.ctag-row{ border:1px solid var(--line); border-radius:12px; padding:12px; margin-bottom:10px; background:var(--surface); }
.ctag-row-head{ display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.ctag-row-head .row-actions{ margin-inline-start:auto; }
.ctag-row-fields{ display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:10px; margin-top:12px; align-items:end; }
.ctag-row-fields .form-row{ margin:0; min-width:0; }
.ctag-row-fields select, .ctag-row-fields input[type=date]{
  width:100%; min-height:38px; border:1.5px solid var(--line); border-radius:var(--radius-sm); padding:7px 10px; font:inherit; font-size:13px;
  background:var(--bg); color:var(--ink); box-sizing:border-box;
}
.form-row .ctag-own{ display:flex; align-items:center; gap:8px; min-height:38px; text-transform:none; letter-spacing:0; font-weight:500; font-size:13px; margin:0; }
.form-row .ctag-own input[type=checkbox]{ width:auto; }
.ctag-add{ display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin:4px 0 14px; }
.ctag-add button{ border:1px dashed var(--line); background:none; border-radius:999px; padding:5px 11px; font:inherit; font-size:12.5px; color:var(--ink); cursor:pointer; }
.ctag-add button:hover{ border-color:var(--accent); }
@media (max-width:700px){
  .ctag-form{ grid-template-columns:1fr; }
  .ctag-preview{ max-width:300px; width:100%; }
}
