/* ==========================================================================
   Den 1880 stamp layer (den-stamps.css)
   Pairs with den-stamps.js. Positioning only; artwork comes from the SVGs.
   Safe to concatenate into a site's main stylesheet.
   ========================================================================== */

/* The anchor element a cluster is pinned to. The script adds this class so we
   never fight an existing `position` value that is already relative/absolute. */
.den-stamp-anchor {
  position: relative;
}

/* Many Den sections carry `overflow: hidden` to tidy their own background.
   That also clips the stamps, which kills the bleed the grammar depends on.
   Only sections that actually hold a cluster are opened up; the elements that
   really need to clip (.hero-video-wrap, cropped watermark clusters) keep
   their own overflow rules. */
section.den-stamp-anchor,
div.den-stamp-anchor {
  overflow: visible;
}

/* One cluster = one passport-stamp group pinned over one section. */
.den-stamp-cluster {
  position: absolute;
  inset: 0;
  overflow: visible;          /* stamps are meant to bleed past the edge */
  pointer-events: none;       /* never eat a click meant for the page */
  z-index: 2;
}

/* Watermark clusters on loud colour fields get cropped by the band edges. */
.den-stamp-cluster[data-crop="true"] {
  overflow: hidden;
}

.den-stamp-cluster[hidden] {
  display: none !important;
}

/* A single stamp. x/y place its centre; the transform does the tilt. */
.den-stamp {
  position: absolute;
  display: block;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
  transform-origin: 50% 50%;
}

.den-stamp[hidden] {
  display: none !important;
}

/* ---------- Respect the visitor ---------------------------------------- */

@media print {
  .den-stamp-cluster { display: none !important; }
}

/* Stamps are decoration. If someone asked for less motion we still show them -
   they don't animate. But any fade-in the host page adds should be skipped. */
@media (prefers-reduced-motion: reduce) {
  .den-stamp { transition: none !important; animation: none !important; }
}

/* ==========================================================================
   Editor overlay. Only present when ?stamps=edit is on the URL.
   Deliberately ugly-but-legible: it is a tool, not a brand surface.
   ========================================================================== */

.den-stamps-editing .den-stamp-cluster { pointer-events: none; }

.den-stamps-editing .den-stamp {
  pointer-events: auto;
  cursor: grab;
  outline: 1px dashed rgba(223, 85, 38, 0.55);
  outline-offset: 2px;
}

.den-stamps-editing .den-stamp:hover {
  outline: 1px solid #df5526;
}

.den-stamps-editing .den-stamp[data-selected="true"] {
  outline: 2px solid #df5526;
  cursor: grabbing;
}

.den-stamps-editing .den-stamp[data-off="true"] {
  display: block !important;
  opacity: 0.18;
  outline: 1px dotted #888;
}

/* Section edges, so you can see what the cluster is meant to cross. */
.den-stamps-editing .den-stamp-cluster::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px dashed rgba(101, 45, 144, 0.4);
  pointer-events: none;
}

.den-ed {
  position: fixed;
  left: 12px;
  bottom: 12px;
  width: 320px;
  max-height: min(78vh, 720px);
  display: flex;
  flex-direction: column;
  background: #1b1c1c;
  color: #f2f1ea;
  border: 1px solid #3a3b3a;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  z-index: 2147483000;
  overflow: hidden;
}

.den-ed[data-collapsed="true"] { max-height: 38px; }

.den-ed__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #16331a;
  cursor: move;
  flex: none;
}

.den-ed__title {
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 10px;
  color: #d3a92a;
  flex: 1;
}

.den-ed__body {
  overflow-y: auto;
  padding: 10px 12px 14px;
}

.den-ed h4 {
  margin: 14px 0 6px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #c3996b;
  font-weight: 700;
}

.den-ed h4:first-child { margin-top: 0; }

.den-ed__row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
}

.den-ed__row--stamp { padding-left: 14px; }

.den-ed__row label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.den-ed__row button.den-ed__pick {
  flex: 1;
  text-align: left;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  padding: 2px 4px;
  border-radius: 3px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.den-ed__row button.den-ed__pick:hover { background: #2c2d2c; }
.den-ed__row[data-selected="true"] button.den-ed__pick { background: #df5526; color: #fff; }

.den-ed input[type="checkbox"] { accent-color: #d3a92a; margin: 0; }

.den-ed input[type="number"],
.den-ed select {
  width: 68px;
  background: #101110;
  color: #f2f1ea;
  border: 1px solid #3a3b3a;
  border-radius: 3px;
  padding: 3px 4px;
  font: inherit;
}

.den-ed select { width: 100%; }

.den-ed__grid {
  display: grid;
  grid-template-columns: 46px 1fr 46px 1fr;
  gap: 5px 6px;
  align-items: center;
}

.den-ed__grid span { color: #9a9b98; }

.den-ed__btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.den-ed button.den-ed__btn {
  background: #d3a92a;
  color: #1b1c1c;
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 10px;
  cursor: pointer;
}

.den-ed button.den-ed__btn--ghost {
  background: none;
  color: #d3a92a;
  border: 1px solid #55563f;
}

.den-ed__lint { margin-top: 12px; }
.den-ed__lint p { margin: 0 0 4px; padding-left: 14px; text-indent: -14px; }
.den-ed__lint p::before { content: "• "; }
.den-ed__lint p[data-level="fail"] { color: #ff8b6f; }
.den-ed__lint p[data-level="flag"] { color: #ffd75e; }
.den-ed__lint p[data-level="pass"] { color: #9ada6a; }

.den-ed__out {
  width: 100%;
  height: 120px;
  margin-top: 10px;
  background: #101110;
  color: #9ada6a;
  border: 1px solid #3a3b3a;
  border-radius: 4px;
  font: 11px/1.4 ui-monospace, Menlo, Consolas, monospace;
  padding: 6px;
  resize: vertical;
}

.den-ed__hint {
  margin-top: 10px;
  color: #8b8c88;
  font-size: 11px;
}

.den-ed__hint kbd {
  background: #2c2d2c;
  border: 1px solid #45463f;
  border-radius: 3px;
  padding: 0 3px;
  font: inherit;
}

/* ---------- Keep a right-bleeding stamp from widening the page ----------
   Clusters are overflow:visible on purpose, so a stamp that hangs off the
   right edge would otherwise add horizontal scroll. `clip` stops that without
   creating a scroll container, so the sticky/fixed topbar keeps working.
   `hidden` is the fallback for browsers without `clip`. */
html { overflow-x: hidden; }
body { overflow-x: hidden; }
@supports (overflow-x: clip) {
  html { overflow-x: clip; }
  body { overflow-x: clip; }
}
