/* ==========================================================================
   Collection Tiles — live "design your tile" editor (marketing site only)
   --------------------------------------------------------------------------
   Controls on the left, a real tile (rendered by the app's own renderTile)
   on the right. Uses the site design tokens from /assets/css/styles.css.
   ========================================================================== */

.ct-editor { max-width: 1040px; margin: 40px auto 0; padding: 0 24px; }
.ct-editor__grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: start;
}
@media (max-width: 820px) {
  .ct-editor__grid { grid-template-columns: 1fr; gap: 24px; }
  .ct-editor__preview {
    order: -1;                 /* show the tile first on mobile */
    background: var(--bg);     /* opaque, so controls don't bleed through behind it */
    top: var(--nav-h);         /* tuck right under the sticky nav (no transparent sliver) */
    padding-bottom: 12px;      /* clean white band below the frame as content scrolls under */
  }
  /* Compact the preview so it doesn't dominate the screen — leaves room for controls. */
  .ct-editor__frame { padding: 14px; }
  .ct-editor__stage { max-width: 230px; }
  .ct-editor__pv-head { margin-bottom: 8px; }
}

/* ---- Controls panel ------------------------------------------------------ */
.ct-editor__controls {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.ct-editor__controls h3 { font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); margin: 22px 0 14px; }
.ct-editor__controls h3:first-child { margin-top: 0; }

.ct-field { margin-bottom: 16px; }
.ct-field__label { display: flex; justify-content: space-between; align-items: baseline; font-size: .9rem; font-weight: 600; color: var(--ink); margin-bottom: 7px; }
.ct-field__val { font-weight: 500; color: var(--accent); font-variant-numeric: tabular-nums; }

.ct-field input[type="text"] {
  width: 100%; font: inherit; font-size: .95rem; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); background: #fff;
}
.ct-field input[type="text"]:focus { outline: none; border-color: var(--accent); }

/* Range sliders */
.ct-field input[type="range"] { width: 100%; accent-color: var(--accent); height: 22px; cursor: pointer; }

/* Colour row: three swatches inline */
.ct-colors { display: flex; gap: 14px; flex-wrap: wrap; }
.ct-color { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; color: var(--text-soft); }
.ct-color input[type="color"] {
  width: 100%; min-width: 64px; height: 34px; padding: 0; border: 1px solid var(--border);
  border-radius: 8px; background: none; cursor: pointer;
}

/* Segmented control (content position) */
.ct-seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.ct-seg button {
  font: inherit; font-size: .88rem; font-weight: 600; padding: 8px 16px; border: 0; cursor: pointer;
  background: #fff; color: var(--text-soft); border-right: 1px solid var(--border);
}
.ct-seg button:last-child { border-right: 0; }
.ct-seg button.is-active { background: var(--accent); color: #fff; }

/* Toggle buttons (add/remove image + countdown) */
.ct-toggles { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.ct-toggle {
  flex: 1 1 auto; font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
  padding: 9px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: #fff; color: var(--ink); transition: border-color .12s, color .12s;
}
.ct-toggle:hover { border-color: var(--accent); color: var(--accent); }
.ct-toggle[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: #f4f2fd; }

/* Disabled field (opacity slider when there's no image) */
.ct-field.is-disabled { opacity: .45; pointer-events: none; }

/* Capabilities note */
.ct-editor__more {
  margin-top: 22px; background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px; font-size: .92rem; color: var(--text-soft);
}
.ct-editor__more strong { color: var(--ink); }

/* ---- Preview ------------------------------------------------------------- */
.ct-editor__preview { position: sticky; top: 92px; }
.ct-editor__pv-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ct-editor__pv-label { font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); font-weight: 700; }

/* Editor-only: make the background image cover the tile box at any height (the
   app shows images whole/contain; for the playground we fill so the preview
   stays clean when the Tile-height slider shrinks the tile). */
.ct-editor__stage .collection-tile__bg-img {
  width: 100% !important; height: 100% !important;
  object-fit: cover !important; object-position: center !important; margin: 0 !important;
}

.ct-editor__frame {
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff;
  box-shadow: var(--shadow-lg); padding: 22px; overflow: hidden;
}
.ct-editor__frame-sub { text-align: center; color: var(--text-faint); font-size: .82rem; margin: 14px 0 0; }

/* The stage that hosts the real tile. Gives the wrapper a definite box so the
   tile's percentage-height area resolves. */
.ct-editor__stage {
  list-style: none; margin: 0 auto; padding: 0;
  width: 100%; max-width: 340px; aspect-ratio: 4 / 5;
  background:
    repeating-linear-gradient(45deg, #f7f9fd, #f7f9fd 12px, #f1f4fa 12px, #f1f4fa 24px);
  border-radius: 10px; overflow: hidden;
}
.ct-editor__stage .collection-tile-wrapper { width: 100%; height: 100%; }
