/* ============================================================
   uicompose — Product Details (brand-aligned polish)
   ============================================================ */

:root {
  --uic-purple: #8735ee;
  --uic-purple-2: #a352ef;
  --uic-purple-3: #c282ff;
  --uic-purple-soft: #f4e9ff;
  --uic-purple-tint: #faf6ff;
  --uic-mint: #00d2a3;
  --uic-ink: #19181f;
  --uic-ink-2: #29252e;
  --uic-body: #6e6876;
  --uic-muted: #918b99;
  --uic-line: #ece8f1;
  --uic-line-2: #f0edf4;
  --uic-soft: #faf9fb;
  --uic-shadow-sm: 0 8px 24px rgba(24, 18, 34, .05);
  --uic-shadow-md: 0 18px 45px rgba(24, 18, 34, .07);
  --uic-shadow-lg: 0 28px 70px rgba(24, 18, 34, .09);
  --uic-radius: 12px;
  --uic-radius-lg: 16px;
  --uic-ease: cubic-bezier(.22, 1, .36, 1);
}

body {
  color: var(--uic-body);
  /* Soft purple glow under the header removed per design feedback —
     plain white keeps the breadcrumb band clean. */
  background: #fff;
}

/* ---------------- Header ---------------- */

.detail-header {
  height: 72px;
  padding-inline: 20px;
  border-bottom: 1px solid var(--uic-line);
}

.detail-header .nav {
  gap: 52px;
}

.detail-header .contact {
  width: 152px;
  height: 46px;
  border: 1.5px solid var(--uic-purple);
  border-radius: 8px;
  color: var(--uic-ink);
  background: #fff;
  font-weight: 700;
  transition: background-color .25s var(--uic-ease), color .25s var(--uic-ease), transform .25s var(--uic-ease);
}

.detail-header .contact:hover {
  background: var(--uic-purple);
  color: #fff;
  transform: translateY(-2px);
}

/* ---------------- Layout ---------------- */

.container {
  width: min(1172px, calc(100% - 64px));
  margin-inline: auto;
}

/* Rich-text details block — renders the admin's RichEditor HTML
   directly under the preview image. Typography mirrors the editor
   so what the author sees in admin = what the visitor sees on the
   product page. */
.content-block.uic-rich-content {
  /* Top margin removed — the gallery moved out of this column, so the
     details top-align with the sidebar's first card (desktop) and don't
     add to the stacking gap (mobile). */
  margin-top: 0;
  /* No outer card chrome — the details text sits directly on the page
     (beats the generic .content-block box below via specificity). */
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.content-block.uic-rich-content h1,
.content-block.uic-rich-content h2,
.content-block.uic-rich-content h3 {
  color: var(--uic-ink, #0f0f14);
  letter-spacing: -0.018em;
}
.content-block.uic-rich-content h1 { font-size: 30px; font-weight: 700; margin: 0.6em 0 0.45em; line-height: 1.18; }
.content-block.uic-rich-content h2 { font-size: 24px; font-weight: 700; margin: 1em 0 0.4em; }
.content-block.uic-rich-content h3 { font-size: 19px; font-weight: 600; margin: 0.9em 0 0.3em; }
/* Paragraph spacing matches the markdown editor's mental model: a
   blank line in the source = a paragraph break = visible gap. The
   short paragraph margin (0.9em ≈ ~14px on body text) gives a clear
   gap between blocks without the old "extra line-height" stretch.
   Note: two soft-break lines in the SAME paragraph (markdown's plain
   Enter, joined by <br/>) stay tight — only true paragraph breaks
   show this gap. That's the WYSIWYG signal: an empty line in the
   textarea ⇒ a real gap in the rendered preview. */
.content-block.uic-rich-content p { margin: 0 0 0.9em; color: var(--uic-body); line-height: 1.7; }
.content-block.uic-rich-content p:last-child { margin-bottom: 0; }
.content-block.uic-rich-content ul,
.content-block.uic-rich-content ol { padding-left: 1.4em; margin: 0 0 0.9em; color: var(--uic-body); }
.content-block.uic-rich-content ul:last-child,
.content-block.uic-rich-content ol:last-child { margin-bottom: 0; }
.content-block.uic-rich-content li { margin: 0.3em 0; line-height: 1.7; }
.content-block.uic-rich-content blockquote {
  border-left: 3px solid var(--uic-purple, #8735ee);
  padding: 6px 16px;
  margin: 1em 0;
  color: #4a4a52;
  background: #faf7ff;
  border-radius: 0 8px 8px 0;
}
.content-block.uic-rich-content pre {
  background: #0f0f14;
  color: #e8e8eb;
  padding: 14px 16px;
  border-radius: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  overflow-x: auto;
}
.content-block.uic-rich-content a { color: var(--uic-purple, #8735ee); text-decoration: underline; }
.content-block.uic-rich-content img { max-width: 100%; height: auto; border-radius: 10px; margin: 0.8em 0; }
.content-block.uic-rich-content hr {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--uic-line) 20%, var(--uic-line) 80%, transparent);
  margin: 1.8em 0;
}

/* Breadcrumb + share button — flex row, both vertically centered on
   the same baseline. The breadcrumb hugs the left; the share button
   slides to the far right via margin-left:auto so it lines up with
   the breadcrumb instead of floating above the navbar. */
.uic-detail-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  position: relative; /* anchor for the branded share popup */
}

/* ---- Branded share popup (replaces the OS native share sheet) ---- */
.uic-share-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  min-width: 224px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--uic-line, #e6e5e0);
  border-radius: 14px;
  box-shadow:
    0 1px 2px rgba(18, 12, 40, .04),
    0 18px 44px -16px rgba(18, 12, 40, .26),
    0 6px 18px -10px rgba(18, 12, 40, .12);
  opacity: 0;
  transform: translateY(-6px) scale(.98);
  transform-origin: top right;
  transition: opacity .16s ease, transform .18s cubic-bezier(.22, 1, .36, 1);
}
.uic-share-pop[hidden] { display: none; }
.uic-share-pop.is-open { opacity: 1; transform: translateY(0) scale(1); }
.uic-share-pop-head {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--uic-faint, #9a9aa3);
  padding: 8px 10px 7px;
}
.uic-share-opt {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--uic-ink, #0f0f14);
  text-decoration: none;
  text-align: left;
  transition: background .14s ease, color .14s ease;
}
.uic-share-opt:hover,
.uic-share-opt:focus-visible {
  background: var(--uic-purple-soft, #f3edff);
  color: var(--uic-purple, #8735ee);
  outline: none;
}
/* Copy-success flash (in-popup feedback). */
.uic-share-opt.is-copied {
  background: rgba(5, 150, 105, .10);
  color: #047857;
  font-weight: 600;
}
.uic-share-opt svg { width: 18px; height: 18px; flex: none; }
@media (prefers-reduced-motion: reduce) {
  .uic-share-pop { transition: none !important; transform: none !important; }
}
.uic-detail-topbar .uic-detail-crumb {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}
.uic-detail-topbar .uic-share-btn {
  margin-left: auto;
  flex-shrink: 0;
}

.template-details {
  padding: 64px 0 56px;
}

/* ── Breadcrumb at the top of the product details page ──────
   "🏠 Marketplace › Templates › <Category> › <Product>". Modern
   minimal style — refined typography, SVG chevron separators,
   subtle hover lift. Sits above the detail-grid, doesn't
   compete with the H1. */
.uic-detail-crumb {
  margin: 0 0 32px;
  font-size: 14px;
  color: var(--uic-muted, #6b6b78);
  line-height: 1.4;
}
.uic-detail-crumb-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.uic-detail-crumb-list > li {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}
.uic-detail-crumb a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--uic-muted, #6b6b78);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: .005em;
  padding: 4px 0;
  border-radius: 4px;
  transition: color .15s ease;
}
.uic-detail-crumb a:hover {
  color: var(--uic-ink, #0f0f14);
}
.uic-detail-crumb-sep {
  /* SVG chevron — much cleaner than a literal `›` character which
     ships at different widths / baselines across system fonts. */
  display: inline-flex;
  align-items: center;
  color: rgba(120, 120, 130, .42);
  user-select: none;
}
.uic-detail-crumb-current {
  display: inline-block;
  color: var(--uic-ink, #0f0f14);
  font-weight: 600;
  letter-spacing: -.001em;
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
@media (max-width: 640px) {
  .uic-detail-crumb { font-size: 11.5px; margin-bottom: 22px; }
  .uic-detail-crumb-list { gap: 4px 7px; }
  .uic-detail-crumb-current { max-width: 200px; }
}

.detail-grid {
  display: grid;
  /* Right sidebar trimmed 430 → 387 (~10% reduction) per design
     feedback — the freed horizontal space flows to the preview
     image + content column on the left, giving the hero
     screenshot a more comfortable aspect ratio. */
  grid-template-columns: minmax(0, 1fr) 387px;
  gap: 56px;
  align-items: start;
}

.template-content {
  min-width: 0;
  display: grid;
  /* Zero outside top-gap — the About / content-block card now sits
     flush against the preview-showcase card above. */
  gap: 0;
}

/* ---------------- Preview Showcase ---------------- */

.preview-showcase {
  /* Outer card boundary removed — the preview image sits on its own (no
     wrapping white box / border / padding). */
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  /* Lives OUTSIDE .detail-grid now — full container width above the
     details + sidebar columns, with a clear gap before them. */
  margin-bottom: 48px;
}

.preview-showcase:hover {
  box-shadow: none;
}

.preview-slider {
  display: grid;
  gap: 22px;
}

.preview-slide {
  display: none;
}

.preview-slide.active {
  display: block;
  animation: uicFade .45s var(--uic-ease);
}

/* Grid mode — 2+ uploaded previews show as a static 2-column tile grid
   (max 4, reference design) instead of the slider. JS toggles .is-grid
   on .preview-showcase and hides the counter/arrow nav. */
.preview-showcase.is-grid .preview-slider {
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.preview-showcase.is-grid .preview-slide {
  display: block;
}
.preview-showcase.is-grid .preview-nav {
  display: none;
}
@media (max-width: 640px) {
  .preview-showcase.is-grid .preview-slider {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@keyframes uicFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.box-img {
  border-radius: var(--uic-radius);
  overflow: hidden;
  background: var(--uic-soft);
  border: 1px solid var(--uic-line);
}

.box-img img,
.detail-preview-placeholder {
  width: 100%;
  /* 10% taller than the old 16:10 per design feedback — 16:11 matches a
     1280×880 px upload exactly (recommended size in the admin editor). */
  aspect-ratio: 16 / 11;
  display: block;
}

.box-img img {
  height: auto;
  object-fit: cover;
  /* Start the preview from the TOP of the design (header / hero) instead
     of cropping a middle slice. */
  object-position: top center;
}

.detail-preview-placeholder {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 16%, rgba(135, 53, 238, .14), transparent 26%),
    radial-gradient(circle at 82% 84%, rgba(0, 210, 163, .12), transparent 30%),
    linear-gradient(135deg, rgba(135, 53, 238, .06), rgba(0, 210, 163, .05)),
    #fbfafd;
}

.detail-preview-placeholder::before {
  content: "";
  position: absolute;
  inset: 48px;
  border-radius: 14px;
  background:
    linear-gradient(var(--uic-ink-2) 0 0) 38px 44px / 40% 16px no-repeat,
    linear-gradient(#ebe5f1 0 0) 38px 80px / 56% 9px no-repeat,
    linear-gradient(#ebe5f1 0 0) 38px 100px / 44% 9px no-repeat,
    linear-gradient(135deg, rgba(135, 53, 238, .82), rgba(0, 210, 163, .62)) right 48px bottom 48px / 34% 38% no-repeat,
    #fff;
  box-shadow: none;
}

.preview-nav {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slider-count {
  height: 36px;
  min-width: 74px;
  padding: 0 14px;
  border-radius: 999px;
  background: #F1F1F1;
  color: #6b6b75;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
}

.slider-count span:first-child {
  color: var(--uic-ink);
}

.slider-count span:last-child {
  color: #9a9aa3;
  opacity: 1;
}

.arrow-group {
  display: flex;
  gap: 8px;
}

.arrow-group button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--uic-line);
  border-radius: 8px;
  background: #fff;
  color: var(--uic-ink);
  font-size: 18px;
  display: grid;
  place-items: center;
  transition: all .25s var(--uic-ease);
}

.arrow-group button:hover {
  background: var(--uic-purple);
  border-color: var(--uic-purple);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(135, 53, 238, .25);
}

/* ---------------- Feature Cards ---------------- */

.main-feature-wrap {
  display: grid;
  /* Auto-fill so admins can type any number of features and the grid
     wraps cleanly — 3 across on desktop, 2 on tablet, 1 on phone. */
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.main-feature {
  min-height: 112px;
  border: 1px solid var(--uic-line);
  border-radius: var(--uic-radius);
  padding: 20px;
  background: #fff;
  transition: transform .3s var(--uic-ease), box-shadow .3s var(--uic-ease), border-color .3s var(--uic-ease);
}

.main-feature:hover {
  transform: none;
  border-color: var(--uic-purple);
  box-shadow: none;
}

.feature-icon {
  width: 38px;
  height: 38px;
  margin-bottom: 14px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--uic-purple-soft);
  color: var(--uic-purple);
  font-size: 16px;
  font-weight: 800;
}

.main-feature p {
  margin: 0;
  color: var(--uic-ink);
  font-size: 16px;
  line-height: 1.32;
  font-weight: 650;
}

/* ---------------- Content Blocks ---------------- */

.content-block,
.pages-included {
  padding: 30px;
  border: 1px solid var(--uic-line);
  border-radius: var(--uic-radius-lg);
  background: #fff;
  box-shadow: none;
}

.content-block h2 {
  /* Sized to match the other section titles further down the page
     (Pages Included h3, Why Choose h3 — all at 22 / 750). Was 28 /
     760 which made it visually compete with the page H1. */
  margin: 0 0 14px;
  color: var(--uic-ink);
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 750;
}

.content-block h3,
.pages-included h3 {
  margin: 0 0 18px;
  color: var(--uic-ink);
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 750;
}

.pages-included h3 {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pages-included h3 span {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--uic-purple-soft);
  color: var(--uic-purple);
  font-size: 14px;
}

.content-block p {
  margin: 0 0 14px;
  color: var(--uic-body);
  font-size: 15.5px;
  line-height: 1.65;
  max-width: 70ch;
}

.content-block p:last-child {
  margin-bottom: 0;
}

/* ---------------- Accordion ---------------- */

.accordion {
  display: grid;
  gap: 10px;
}

.accordion-card {
  border: 1px solid var(--uic-line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  transition: border-color .25s var(--uic-ease), box-shadow .25s var(--uic-ease);
}

.accordion-card:hover {
  border-color: #e0d4f2;
}

.accordion-card.active {
  border-color: var(--uic-purple);
  box-shadow: none;
}

.accordion-card button {
  width: 100%;
  min-height: 56px;
  padding: 0 22px;
  border: 0;
  background: #fff;
  color: var(--uic-ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 650;
  text-align: left;
  transition: background-color .25s var(--uic-ease);
}

.accordion-card.active button {
  background: #fff;
  border-bottom: 1px solid var(--uic-line);
}

.accordion-card button::after {
  content: "+";
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--uic-purple-soft);
  color: var(--uic-purple);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 700;
  transition: transform .3s var(--uic-ease), background .25s var(--uic-ease), color .25s var(--uic-ease);
}

.accordion-card.active button::after {
  content: "−";
  background: var(--uic-purple);
  color: #fff;
  transform: rotate(180deg);
}

.accordion-body {
  display: none;
  padding: 20px 22px 22px;
}

.accordion-card.active .accordion-body {
  display: block;
  animation: uicFade .35s var(--uic-ease);
}

.accordion-body p {
  margin: 0;
  color: var(--uic-body);
  font-size: 14.5px;
  line-height: 1.6;
}

/* ---------------- Sidebar ---------------- */

.template-sidebar {
  /* Sticky removed per design feedback — the sidebar scrolls with the
     page like any other column. */
  position: static;
  align-self: start;
  /* Outer card boundary removed — the sidebar is now just a transparent
     stack of the inner cards (Overview / Product Description / CMS). */
  padding: 0 0 28px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.template-sidebar::before {
  display: none;
}

.breadcrumb-menu {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--uic-muted);
  font-size: 12.5px;
  font-weight: 600;
}

.breadcrumb-menu a {
  color: var(--uic-body);
  transition: color .2s ease;
}

.breadcrumb-menu a:hover {
  color: var(--uic-purple);
}

.breadcrumb-menu span {
  opacity: .5;
}

.uic-detail-titlebar {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  /* Sits between the breadcrumb and the full-width gallery now
     (moved out of the sidebar — reference layout). */
  margin: 6px 0 26px;
}
.uic-detail-titlebar h1 {
  margin: 0;
  flex: 1;
  min-width: 0;
  color: var(--uic-ink);
  font-size: 38px;
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.template-sidebar h1 {
  margin: 14px 0 12px;
  color: var(--uic-ink);
  font-size: 32px;
  line-height: 1.06;
  letter-spacing: -0.028em;
  font-weight: 800;
}

/* Share button — lives in the breadcrumb topbar row, lined up with
   "Marketplace › Templates › …". Web Share API on mobile,
   copy-to-clipboard everywhere else; toast lives under the sidebar
   breadcrumb. */
.uic-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1.5px solid var(--uic-line-2, #ececef);
  border-radius: 999px;
  background: #ffffff;
  color: var(--uic-ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(24, 18, 34, .04);
  transition: border-color .18s ease, color .18s ease, background-color .18s ease, transform .14s ease, box-shadow .18s ease;
}
.uic-share-btn:hover {
  border-color: var(--uic-purple);
  color: var(--uic-purple);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(135, 53, 238, .14);
}
.uic-share-btn svg { flex-shrink: 0; }
@media (max-width: 640px) {
  .uic-share-btn > span { display: none; }
  .uic-share-btn {
    width: 36px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
}

/* Toast that flashes when the share fallback (clipboard copy) runs. */
.uic-share-toast {
  margin: -8px 0 14px;
  padding: 8px 12px;
  background: rgba(16, 185, 129, .12);
  border: 1px solid rgba(16, 185, 129, .35);
  color: #0f7a4a;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  animation: uic-share-toast-in .2s ease;
}
.uic-share-toast[hidden] { display: none !important; }
@keyframes uic-share-toast-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.breadcrumb-text {
  margin: 0 0 16px;
  color: var(--uic-body);
  font-size: 14px;
  line-height: 1.6;
  /* Break long unbroken strings (e.g. a URL or gibberish with no spaces)
     so the description wraps inside the sidebar instead of overflowing. */
  overflow-wrap: anywhere;
  word-break: break-word;
}

.download-type {
  display: inline-flex;
  align-items: center;
  height: 28px;
  margin-bottom: 18px;
  padding: 0 13px;
  border-radius: 999px;
  background: var(--uic-purple-soft);
  color: var(--uic-purple);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .01em;
}

/* Info list */

.uic-detail-info {
  margin: 0;
  padding-top: 6px;
  border-top: 1px solid var(--uic-line-2);
}

.uic-detail-info div {
  min-height: 46px;
  padding: 13px 0;
  border-bottom: 1px solid var(--uic-line-2);
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 14px;
  /* Top-align so a value that wraps to 2+ lines keeps its first line
     level with the label, instead of vertically centring the block. */
  align-items: start;
}

.uic-detail-info div:last-child {
  border-bottom: 0;
}

/* Quiet micro-caps label — reads clearly as a field name and lets the
   value carry the visual weight. Clean spec-sheet hierarchy. */
.uic-detail-info dt {
  color: var(--uic-faint, #9a9aa3);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.uic-detail-info dd {
  margin: 0;
  color: var(--uic-ink);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  font-size: 13.5px;
  font-weight: 600;
  text-align: right;
}

/* CMS box */

.cms-box {
  /* Sidebar previously had a 1px divider above "Select Your CMS" —
     removed per design feedback; the info list and the CMS selector
     now flow as one continuous panel. */
  margin-top: 18px;
}

.cms-box > p {
  margin: 0 0 12px;
  color: var(--uic-ink);
  font-size: 16px;
  /* Match the Overview / Product Description headings (700). !important:
     theme.js injects a body font-weight that otherwise wins. */
  font-weight: 700 !important;
  letter-spacing: -0.012em;
}

.cms-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cms-option {
  position: relative;
  min-height: 52px;
  padding: 10px 38px 10px 14px;
  border: 1.5px solid var(--uic-line);
  border-radius: 10px;
  background: #fff;
  color: var(--uic-ink);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  transition: all .25s var(--uic-ease);
}

.cms-option:hover {
  border-color: var(--uic-purple);
  background: var(--uic-purple-tint);
  transform: translateY(-2px);
}

.cms-option.selected {
  border-color: var(--uic-purple);
  background: var(--uic-purple-tint);
  box-shadow: 0 10px 22px rgba(135, 53, 238, .12);
}

.cms-option .check-icon { display: none; }

.cms-option .cms-platform-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--uic-ink);
  flex-shrink: 0;
}
.cms-option .cms-platform-icon svg {
  width: 100%;
  height: 100%;
}
.cms-option.selected .cms-platform-icon {
  color: var(--uic-purple);
}

.cms-option.selected::after {
  content: "✓";
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--uic-purple);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
}

.cms-logo {
  color: var(--uic-ink);
  /* Slightly larger + medium weight per design feedback — was 13.5px
     bold, now 15px medium. Reads cleaner and matches the rest of
     the sidebar info list weight. */
  font-size: 15px;
  font-weight: 500;
  margin-top: 0;
  flex: 1;
}

.cms-option strong {
  font-size: 14px;
  font-weight: 500;
  color: var(--uic-muted);
  margin-left: auto;
  margin-right: 8px;
}

.cms-option.selected strong {
  color: var(--uic-purple);
}

/* Actions */

.template-actions {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.live-btn,
.solid-btn,
.speed-btn,
.outline-btn {
  height: 50px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: .005em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  text-decoration: none;
  transition: transform .3s var(--uic-ease), box-shadow .3s var(--uic-ease), background-color .3s var(--uic-ease), color .3s var(--uic-ease), border-color .3s var(--uic-ease);
}

.live-btn {
  border: 1.5px solid var(--uic-purple);
  color: var(--uic-purple);
  background: #fff;
}
/* The shared `.live-btn, .solid-btn, .speed-btn, .outline-btn` rule
   sets `display: flex`, which beats the user-agent stylesheet's
   `[hidden] { display: none }` because class selectors win on
   specificity. Without an explicit override, setting `live.hidden =
   true` in JS had no visual effect — so the Live Preview button
   stayed on the Figma row alongside Preview screenshots. */
.live-btn[hidden],
.solid-btn[hidden],
.outline-btn[hidden] { display: none !important; }

.live-btn:hover {
  background: var(--uic-purple);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(135, 53, 238, .22);
}

/* Page Speed check — emerald accent (Google PageSpeed brand), ghost
   style with a subtle gauge-ring icon. Sits between Live Preview
   (primary purple outline) and Download (purple solid) in hierarchy. */
.speed-btn {
  border: 1.5px solid var(--uic-speed, #d1fadf);
  color: var(--uic-speed-ink, #1f7a3a);
  background: linear-gradient(180deg, #f0fdf4 0%, #ecfdf5 100%);
  padding: 0 18px;
}
.speed-btn[hidden] { display: none !important; }
.speed-btn .speed-btn-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(31, 122, 58, .12), inset 0 0 0 1.5px #16a34a;
  flex-shrink: 0;
  margin-right: 4px;
}
.speed-btn .speed-btn-dot svg { width: 12px; height: 12px; color: #16a34a; }
.speed-btn-label-small {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: .72;
  margin-right: 2px;
}
.speed-btn:hover {
  background: #16a34a;
  color: #ffffff;
  border-color: #16a34a;
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(22, 163, 74, .26);
}
.speed-btn:hover .speed-btn-dot {
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0,0,0,.15), inset 0 0 0 1.5px #16a34a;
}
.speed-btn:hover .speed-btn-dot svg { color: #16a34a; }
.template-actions .speed-btn { grid-column: 1 / -1; }

.solid-btn {
  background: linear-gradient(135deg, var(--uic-purple), var(--uic-purple-2));
  color: #fff;
  border: 0;
}

.solid-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(120deg, transparent 0 28%, rgba(255, 255, 255, .25) 42%, transparent 56%);
  transform: translateX(-120%);
  transition: transform .7s var(--uic-ease);
}

.solid-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(135, 53, 238, .32);
}

.solid-btn:hover::before {
  transform: translateX(120%);
}

.outline-btn {
  border: 1.5px solid var(--uic-purple);
  color: var(--uic-ink);
  background: #fff;
}

.outline-btn:hover {
  color: var(--uic-purple);
  border-color: var(--uic-purple);
}

/* Promo banner */

.template-banner {
  display: block;
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: var(--uic-radius);
  color: #fff;
  background:
    radial-gradient(circle at 78% 22%, rgba(255, 255, 255, .35), transparent 30%),
    linear-gradient(135deg, var(--uic-purple), var(--uic-purple-2) 60%, var(--uic-purple-3));
  box-shadow: 0 14px 30px rgba(135, 53, 238, .22);
  transition: transform .35s var(--uic-ease), box-shadow .35s var(--uic-ease);
}

.template-banner:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 44px rgba(135, 53, 238, .3);
}

.template-banner.small {
  min-height: 78px;
}

.template-banner span {
  display: block;
  margin-bottom: 6px;
  color: rgba(255, 255, 255, .78);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.template-banner strong {
  display: block;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-weight: 750;
}

/* Feature box */

.feature-box {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--uic-line-2);
}

.feature-box h3 {
  margin: 0 0 14px;
  color: var(--uic-ink);
  font-size: 16px;
  letter-spacing: -0.015em;
  font-weight: 750;
}

.feature-box p {
  margin: 0 0 14px;
  color: var(--uic-muted, var(--uic-ink));
  font-size: 13px;
  line-height: 1.5;
}
.feature-box p:empty {
  display: none;
  margin: 0;
}

.feature-box ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.feature-box li {
  position: relative;
  padding-left: 24px;
  color: var(--uic-ink);
  font-size: 12.5px;
  line-height: 1.35;
  font-weight: 550;
}

.feature-box li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--uic-purple-soft);
}

.feature-box li::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 4px;
  width: 4px;
  height: 7px;
  border: solid var(--uic-purple);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ---------------- Download email-gate modal ---------------- */
.download-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 23, 0.78);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  display: grid;
  place-items: center;
  z-index: 1000;
  padding: 20px;
  animation: dlFade .2s ease-out;
}
.download-modal-overlay[hidden] { display: none; }
@keyframes dlFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.download-modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  padding: 28px 28px 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
  text-align: center;
  animation: dlPop .22s ease-out;
}
@keyframes dlPop {
  from { opacity: 0; transform: scale(.94); }
  to { opacity: 1; transform: scale(1); }
}
.download-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  color: var(--uic-muted);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.download-modal-close:hover {
  background: var(--uic-line);
  color: var(--uic-ink);
}
.download-modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--uic-purple-tint);
  color: var(--uic-purple);
}
.download-modal-title {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 700;
  color: var(--uic-ink);
  letter-spacing: -0.01em;
}
.download-modal-body {
  margin: 0 0 18px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--uic-muted);
}
.download-modal-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.download-modal-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--uic-line);
  border-radius: 10px;
  font-size: 14px;
  color: var(--uic-ink);
  background: #fff;
  transition: border-color .12s;
  font-family: inherit;
}
.download-modal-input:focus {
  outline: none;
  border-color: var(--uic-purple);
}
.download-modal .download-modal-submit {
  width: 100%;
  height: 44px;
  border: none !important;
  border-radius: 10px;
  background: var(--uic-purple) !important;
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, transform .12s;
  font-family: inherit;
}
.download-modal .download-modal-submit:hover { background: var(--uic-purple-deep, #7028d2) !important; }
.download-modal .download-modal-submit:disabled { opacity: .6; cursor: default; transform: none; }
.download-modal-status {
  margin: 12px 0 0;
  font-size: 13px;
  min-height: 18px;
}
.download-modal-status.is-success { color: #047857; }
.download-modal-status.is-error { color: #b3261e; }

/* ---------------- Related Section ---------------- */

.related-section {
  /* +60px top (gap from the product details above) and +60px bottom
     (gap to the footer), per design request. */
  padding: 84px 0 172px;
}

.section-head {
  /* Title left, "All Templates →" link right, both vertically
     centred in the same row. */
  margin-bottom: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.section-head h2 {
  margin: 0;
  color: var(--uic-ink);
  font-size: 42px;
  line-height: 1.08;
  letter-spacing: -0.032em;
  font-weight: 800;
}

.section-head p {
  margin: 6px 0 0;
  color: var(--uic-body);
  font-size: 16px;
}

.section-head a {
  height: 44px;
  padding: 0 22px;
  border: 1.5px solid var(--uic-purple);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  color: var(--uic-ink);
  font-weight: 500;
  font-size: 14px;
  transition: all .25s var(--uic-ease);
}

.section-head a:hover {
  background: var(--uic-purple);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(135, 53, 238, .22);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.related-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.related-card .related-img {
  aspect-ratio: 1.38 / 1;
  border-radius: var(--uic-radius-lg);
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(135, 53, 238, .08), rgba(0, 210, 163, .08)),
    var(--uic-soft);
  position: relative;
  display: grid;
  place-items: center;
  padding: 28px;
  border: 1px solid var(--uic-line);
  transition: box-shadow .35s var(--uic-ease), border-color .35s var(--uic-ease);
}
.related-card:hover .related-img {
  box-shadow: 0 18px 45px rgba(24, 18, 34, .08);
}

/* When a real product image is rendered inside, fill the card edge-to-edge */
.related-card .related-img > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Crop from the TOP so the card shows the design's header band, not a
     middle slice. */
  object-position: top center;
  display: block;
}
.related-card .related-img:has(img) {
  padding: 0;
  background: var(--uic-soft);
}

.related-card:hover .related-img {
  border-color: #e0d4f2;
}

.related-card:nth-child(2) .related-img {
  background:
    linear-gradient(135deg, rgba(47, 131, 255, .08), rgba(135, 53, 238, .08)),
    var(--uic-soft);
}

.related-card:nth-child(3) .related-img {
  background:
    linear-gradient(135deg, rgba(255, 93, 34, .08), rgba(135, 53, 238, .08)),
    var(--uic-soft);
}

.related-screen {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  border: 1px solid var(--uic-line);
  background:
    linear-gradient(var(--uic-ink-2) 0 0) 28px 30px / 42% 12px no-repeat,
    linear-gradient(#ece7f2 0 0) 28px 62px / 66% 8px no-repeat,
    linear-gradient(#ece7f2 0 0) 28px 84px / 48% 8px no-repeat,
    linear-gradient(135deg, rgba(135, 53, 238, .72), rgba(0, 210, 163, .52)) right 28px bottom 28px / 36% 34% no-repeat,
    #fff;
  box-shadow: 0 18px 45px rgba(24, 18, 34, .08);
  position: relative;
  padding: 24px;
}

.related-screen::before {
  content: "";
  position: absolute;
  left: 28px;
  right: 28px;
  top: 54%;
  height: 1px;
  background: #ece8f1;
}

.related-screen::after {
  content: "";
  position: absolute;
  left: 28px;
  bottom: 42px;
  width: 38%;
  height: 14px;
  border-radius: 999px;
  background: var(--uic-ink-2);
}

.related-screen span {
  position: absolute;
  left: 28px;
  bottom: 22px;
  width: 58%;
  height: 8px;
  border-radius: 999px;
  background: #ded9e7;
}

.related-screen span:nth-child(2) {
  left: auto;
  right: 28px;
  top: 30px;
  bottom: auto;
  width: 18%;
}

.related-screen span:nth-child(3) {
  bottom: 96px;
  width: 24%;
}

.related-arrow {
  display: none;
}

.related-content {
  padding-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.related-content > div:first-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.related-content h3 {
  margin: 0;
  color: var(--uic-ink);
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: -0.018em;
  font-weight: 700;
  transition: color .2s var(--uic-ease);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.related-card:hover .related-content h3 {
  color: var(--uic-purple);
}

/* Platform — brand logo in a round badge on the RIGHT, next to the
   soft-purple price pill (mirrors the home/product grid card icons). */
.related-plat-badge {
  width: 30px;
  height: 30px;
  border: 1px solid var(--uic-line-2, #eeeaf2);
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: #fff;
  flex: none;
}
.related-plat-ico { display: inline-grid; place-items: center; width: 17px; height: 17px; }
.related-plat-ico svg { width: 100%; height: 100%; display: block; }
.related-plat-letter {
  font-size: 12px;
  font-weight: 700;
  color: var(--uic-muted, #6b6b75);
}

.related-meta {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Price / license — EXACT copy of the home/component card Free pill
   (.type-free): soft-purple bg, calm gray-black text, weight 600 — so
   it reads light, not heavy. */
.related-meta strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f5ecff;
  color: rgba(0, 0, 0, 0.39);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------------- Footer adjustment ---------------- */

.detail-footer {
  margin-top: 0;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 1180px) {
  .detail-grid {
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 40px;
  }
}

@media (max-width: 1050px) {
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .template-sidebar {
    position: static;
    order: -1;
  }

  .main-feature-wrap,
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .feature-box ul {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  /* Mobile margin: 20px each side instead of the 32px the default
     `calc(100% - 64px)` was giving + the 16px polish.css padding on
     top of that. The page felt too inset on small viewports — content
     cards were already padded so the extra outer margin was
     double-spacing. !important needed to beat polish.css's
     mobile-only padding override. */
  .container {
    width: calc(100% - 40px) !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: none !important;
  }

  .template-details {
    padding: 40px 0 32px;
  }

  .detail-header {
    height: auto;
    padding: 18px 22px;
    gap: 14px;
  }

  .template-sidebar h1 {
    font-size: 28px;
  }

  .section-head {
    /* Mobile: stack the title above the link (no room for them
       side-by-side at this width), and align everything to the
       left to match the rest of the mobile content padding. */
    align-items: flex-start;
    flex-direction: column;
  }

  .section-head h2 {
    font-size: 32px;
  }

  .main-feature-wrap,
  .related-grid,
  .feature-box ul {
    grid-template-columns: 1fr;
  }

  .cms-options {
    grid-template-columns: 1fr;
  }

  .content-block,
  .pages-included {
    padding: 22px;
  }
}

/* ============================ Live preview iframe ============================
   Renders when admin sets `metadata.livePreviewUrl` (or the first CMS
   option carries a URL). Replaces the image stack with an interactive
   iframe of the real product + Desktop / Tablet / Mobile toggle. The
   iframe stays loaded across toggles — only the wrapper width changes
   so the page inside reflows to its own responsive breakpoints. */
.preview-slide.preview-live {
  padding: 0;
}
.preview-device-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  margin: 14px auto 12px;
  background: var(--bg-soft, #f4f4f5);
  border: 1px solid var(--line, #e6e6e6);
  border-radius: 999px;
}
.preview-device-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted, #6b7280);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.preview-device-toggle button:hover {
  color: var(--ink, #0a0a0b);
}
.preview-device-toggle button.is-active {
  background: var(--ink, #0a0a0b);
  color: #fff;
}
.preview-device-toggle button svg {
  display: block;
}

.preview-live-frame {
  position: relative;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line, #e6e6e6);
  border-radius: 14px;
  overflow: hidden;
  transition: width .28s cubic-bezier(.22, 1, .36, 1), max-width .28s ease;
  /* Aspect-ratio per device — taller for tablet/mobile portrait. */
  --aspect: 16 / 10;
  aspect-ratio: var(--aspect);
  width: 100%;
  max-width: 100%;
}
.preview-live-frame[data-device="tablet"] {
  --aspect: 3 / 4;
  width: min(720px, 100%);
}
.preview-live-frame[data-device="mobile"] {
  --aspect: 9 / 19.5;
  width: min(380px, 100%);
}
.preview-live-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

@media (max-width: 640px) {
  .preview-device-toggle {
    margin-top: 10px;
    margin-bottom: 10px;
  }
  .preview-device-toggle button {
    padding: 0 10px;
    font-size: 12px;
  }
  .preview-device-toggle button span {
    /* On phones the device labels squeeze — icon alone is enough. */
    display: none;
  }
  .preview-device-toggle button {
    width: 36px;
    padding: 0;
    justify-content: center;
  }
  .preview-live-frame[data-device="tablet"] {
    /* Tablet preview at phone size = squashed; cap it. */
    width: 100%;
  }
  .preview-live-frame[data-device="mobile"] {
    width: 90%;
  }
}

/* ============================ Live preview modal ============================
   Triggered by the "Live Preview" button. Full-screen overlay with a
   Desktop / Tablet / Mobile toggle in the header and the embedded
   iframe below. Swapping the toggle resizes the wrapper so the
   embedded page reflows to that breakpoint; the iframe `src` stays
   loaded across toggles.

   The modal element is created lazily by JS on first open; it lives
   under <body> so it overlays everything. */
.live-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  align-items: stretch;
  justify-content: center;
}
.live-preview-modal.is-open {
  display: flex;
}
body.live-preview-open {
  overflow: hidden;
}
.live-preview-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 11, .68);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.live-preview-modal-card {
  position: relative;
  z-index: 1;
  width: min(1280px, calc(100% - 32px));
  height: min(880px, calc(100% - 32px));
  margin: auto;
  display: flex;
  flex-direction: column;
  background: var(--uic-soft, #faf9fb);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(15, 17, 23, .35);
  animation: livePreviewIn .22s cubic-bezier(.22, 1, .36, 1);
}
@keyframes livePreviewIn {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.live-preview-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--uic-line, #ece8f1);
}
.live-preview-modal-head .preview-device-toggle {
  margin: 0;
}
.live-preview-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--uic-line, #ece8f1);
  background: #fff;
  color: var(--uic-ink, #19181f);
  border-radius: 9px;
  cursor: pointer;
  transition: border-color .12s ease, color .12s ease, background .12s ease;
}
.live-preview-modal-close:hover {
  border-color: var(--uic-purple, #8735ee);
  color: var(--uic-purple, #8735ee);
}
.live-preview-modal-stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--uic-soft, #faf9fb);
  /* Faint dot grid so the device frames are visible when the iframe
     is narrower than the stage (tablet / mobile views). */
  background-image:
    radial-gradient(circle, rgba(15, 17, 23, .06) 1px, transparent 1px);
  background-size: 14px 14px;
}
/* The stage's .preview-live-frame keeps its existing styles —
   transitions + aspect-ratio behaviour are the same as outside the
   modal. We just override the max-height so it can fill the modal. */
.live-preview-modal-stage .preview-live-frame {
  max-height: 100%;
}

@media (max-width: 640px) {
  .live-preview-modal-card {
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
  .live-preview-modal-head {
    padding: 10px 12px;
  }
  .live-preview-modal-stage {
    padding: 10px;
  }
}

/* ── "Preview screenshots" button (sidebar) ──────────────────
   Outlined / ghost style — keeps strong visual distinction from
   the Download Template button below (which is the primary
   gradient-solid CTA). Both can be on the sidebar together for
   Figma rows, so colour collision would weaken the hierarchy.
   Shape matches the other action buttons (height 50, flex
   centred, etc.). */
.preview-btn {
  height: 50px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: .005em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  text-decoration: none;
  /* Pure white background + 1.5px purple border + purple text —
     ghost style. Reads as a secondary "look at the design" action
     against the bold Download Template gradient sitting below it. */
  border: 1.5px solid var(--uic-purple);
  background: #ffffff;
  color: var(--uic-purple);
  padding: 0 18px;
  transition: transform .3s var(--uic-ease), box-shadow .3s var(--uic-ease), background-color .3s var(--uic-ease), color .3s var(--uic-ease), border-color .3s var(--uic-ease);
}
.preview-btn[hidden] { display: none !important; }
.preview-btn:hover {
  /* On hover, fill in to the solid purple so the affordance is
     unambiguous (mirrors .live-btn's hover style). */
  background: var(--uic-purple);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(135, 53, 238, .22);
}
.preview-btn svg { color: inherit; flex-shrink: 0; }
.preview-btn > span { line-height: 1; }
.template-actions .preview-btn { grid-column: 1 / -1; }

/* ── Lightbox: per-CMS screenshots slider ──────────────────── */
html.uic-pv-locked { overflow: hidden; }
.uic-pv {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
}
.uic-pv.is-open { display: block; }
.uic-pv-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 12, 0.84);
  backdrop-filter: blur(6px);
  cursor: zoom-out;
  animation: uic-pv-fade .2s ease;
}
@keyframes uic-pv-fade { from { opacity: 0; } to { opacity: 1; } }
.uic-pv-stage {
  position: relative;
  height: 100%;
  /* Scroll the WHOLE stage so the image (at its natural size) can
     overflow both axes and the user reaches it with the mouse wheel
     / trackpad. Previously the stage was a flex centered box and
     bigger-than-viewport images were squashed by max-width/height.
     The chrome (close, arrows, caption, thumbs) is overlaid via
     position: fixed/absolute now (see below) so it stays visible
     regardless of scroll position. */
  overflow: auto;
  display: block;
  padding: 56px 64px 120px;
  text-align: center;
  pointer-events: none;
  animation: uic-pv-pop .25s cubic-bezier(.22, 1, .36, 1);
  /* Smoother momentum scroll on touch / trackpad. */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.35) transparent;
}
.uic-pv-stage::-webkit-scrollbar { width: 12px; height: 12px; }
.uic-pv-stage::-webkit-scrollbar-thumb { background: rgba(255,255,255,.28); border-radius: 8px; }
.uic-pv-stage::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.45); }
.uic-pv-stage::-webkit-scrollbar-track { background: transparent; }
@keyframes uic-pv-pop {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: 1; transform: scale(1); }
}
.uic-pv-stage > * { pointer-events: auto; }
.uic-pv-close {
  /* fixed — pinned to viewport so the close button stays reachable
     no matter how far the user has scrolled into a tall image. */
  position: fixed;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, .12);
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease;
  z-index: 2;
}
.uic-pv-close:hover { background: rgba(255, 255, 255, .22); }
.uic-pv-arrow {
  /* fixed — same reason as the close button. Stays centred on the
     viewport's vertical mid regardless of scroll. */
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, .12);
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
  z-index: 2;
}
.uic-pv-arrow:hover {
  background: rgba(255, 255, 255, .22);
  /* polish.css ships a blanket `button:hover { transform: none
     !important }` to neutralise stray button hover effects. That
     was clobbering the arrow's vertical-centring translateY(-50%)
     on hover, making the buttons appear to fall down by half their
     height. Re-assert the centering transform with !important so
     the arrows stay locked to the viewport vertical centre. */
  transform: translateY(-50%) !important;
}
.uic-pv-prev { left: 18px; }
.uic-pv-next { right: 18px; }
.uic-pv-figure {
  margin: 0 auto;
  /* No max-width / max-height — image flows at its natural size so
     a 1600px screenshot opens at 1600px. The stage above scrolls
     when content exceeds the viewport. */
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.uic-pv-img {
  display: block;
  /* Natural dimensions. Width/height attribute on <img> drives the
     intrinsic size and prevents the browser from auto-shrinking. */
  width: auto;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
  background: #0f0f14;
}
/* .uic-pv-caption removed along with the thumbnail strip — the
   counter pill below replaces both. */

/* Compact "1/2" counter pill — replaces the old thumbnail strip.
   Pinned to the viewport bottom-centre so it stays visible while
   scrolling a tall screenshot. */
.uic-pv-counter {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(15, 17, 23, .68);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  z-index: 2;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.uic-pv-counter[hidden] { display: none !important; }
/* Thumbnail strip removed — design feedback: 1/2 / 1/3 counter
   replaces it. .uic-pv-thumb* styles are gone; .uic-pv-counter
   above is the replacement. */

@media (max-width: 640px) {
  .uic-pv-stage { padding: 50px 12px 80px; }
  .uic-pv-arrow { width: 38px; height: 38px; font-size: 22px; }
  .uic-pv-prev { left: 8px; }
  .uic-pv-next { right: 8px; }
  .uic-pv-counter { bottom: 14px; height: 26px; font-size: 12px; min-width: 50px; }
}

/* Sidebar detail-info — Tags row + extra metadata rows */
.uic-detail-info div[hidden] { display: none !important; }

/* Tags row uses the standard 2-column layout (label left, value right)
   like every other sidebar row — the chips wrap RIGHT-aligned in the
   value column, top-aligned with the "TAGS" label. */
.uic-detail-info dd.uic-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  text-align: right;
  justify-content: flex-end;
  justify-self: stretch;
  max-width: 100%;
}
.uic-detail-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  background: var(--uic-purple-soft, #f3edff);
  color: var(--uic-purple, #8735ee);
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.45;
}

/* ============================================================
   Sidebar — "stacked card" restyle (EXPERIMENTAL).
   Revert point: git tag `sidebar-original-4c50fcd`. To revert: delete
   this block + bump the css version. CSS-only, no HTML/JS changes — the
   "Overview" / "Product Description" headings are ::before pseudo-text.
   ============================================================ */

/* Overview card removed per design feedback — #detailDescription is
   hidden in the markup; the spec list opens the sidebar directly. */

/* Product Description card — spec list in a bordered white card. */
.template-sidebar .uic-detail-info {
  margin-top: 0;
  padding: 2px 22px 16px;
  background: #fff;
  border: 1px solid var(--uic-line-2, #ececf1);
  border-radius: 16px;
}
.template-sidebar .uic-detail-info::before {
  content: "Product Description";
  display: block;
  padding: 16px 0 6px;
  color: var(--uic-ink, #0f0f14);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.012em;
}
/* Rows — normal-case labels + a soft-gray divider between each. */
.template-sidebar .uic-detail-info > div {
  border-bottom: 1px solid var(--uic-line-2, #eef0f4);
  min-height: 0;
  padding: 11px 0;
}
.template-sidebar .uic-detail-info > div:last-child { border-bottom: 0; }
.template-sidebar .uic-detail-info dt {
  text-transform: none;
  letter-spacing: normal;
  font-size: 14px;
  font-weight: 500;
  color: var(--uic-muted, #8a8a93);
}
.template-sidebar .uic-detail-info dd {
  font-size: 14px;
  font-weight: 600;
  color: var(--uic-ink, #0f0f14);
}
/* Category → soft pill on the right (matches the reference). */
.template-sidebar .uic-detail-info #detailCategory {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--uic-purple-soft, #f3edff);
  color: var(--uic-purple, #8735ee);
  font-size: 13px;
  font-weight: 600;
}

/* Align the sidebar title with the TOP of the left preview box (both
   sit at the detail-grid top; the title's default margins pushed it
   ~28px lower). */
.template-sidebar .uic-detail-titlebar { margin-top: 0; }
.template-sidebar h1 { margin-top: 0; }

/* ============================================================
   Title-row actions — compact CMS dropdown + Preview + Download
   cluster on the right of the product title (reference layout).
   The .cms-box option list becomes a popover under .cms-dd-trigger.
   ============================================================ */
.uic-detail-titlebar {
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 14px;
}
.uic-title-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.uic-title-actions .cms-box {
  position: relative;
  margin: 0;
}
/* The "Select Your CMS" label is redundant in dropdown form. */
.uic-title-actions .cms-box > p { display: none; }

.cms-dd-trigger {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 14px;
  border: 1.5px solid var(--uic-line);
  border-radius: 12px;
  background: #fff;
  color: var(--uic-ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s var(--uic-ease), box-shadow .2s var(--uic-ease);
}
.cms-dd-trigger:hover,
.cms-box.open .cms-dd-trigger {
  border-color: var(--uic-purple);
  box-shadow: 0 8px 20px -12px rgba(135, 53, 238, .35);
}
.cms-dd-trigger .cms-platform-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
}
.cms-dd-trigger .cms-platform-icon svg { width: 100%; height: 100%; }
.cms-dd-trigger .cms-dd-price {
  color: var(--uic-purple);
  font-weight: 600;
}
.cms-dd-trigger .cms-dd-caret {
  color: var(--uic-muted);
  transition: transform .2s var(--uic-ease);
}
.cms-box.open .cms-dd-caret { transform: rotate(180deg); }

/* Option list → absolute popover panel under the trigger. */
.uic-title-actions .cms-options {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 250px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--uic-line);
  border-radius: 14px;
  box-shadow: 0 24px 50px -18px rgba(18, 12, 40, .22);
  display: none;
  z-index: 80;
}
.uic-title-actions .cms-box.open .cms-options { display: flex; }
.uic-title-actions .cms-option {
  min-height: 46px;
  border: 0;
  border-radius: 9px;
}
.uic-title-actions .cms-option:hover { transform: none; }
.uic-title-actions .cms-option.selected { box-shadow: none; }

/* Compact horizontal buttons in the title row. */
.uic-title-actions .template-actions {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.uic-title-actions .live-btn,
.uic-title-actions .solid-btn,
.uic-title-actions .preview-btn,
.uic-title-actions .speed-btn {
  height: 46px;
  padding: 0 18px;
  white-space: nowrap;
}
.uic-title-actions .template-actions .speed-btn { grid-column: auto; }

/* Mobile: cluster drops below the title, full width; download grows. */
@media (max-width: 767px) {
  .uic-title-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .uic-title-actions .template-actions {
    flex: 1 1 100%;
    flex-wrap: wrap;
  }
  .uic-title-actions .solid-btn { flex: 1 1 auto; }
}

/* Title block — reference style: big title with a one-line muted
   subtitle (the product's short description) on the left, the CMS
   dropdown + Preview + Download cluster on the right. */
.uic-title-main {
  flex: 1 1 320px;
  min-width: 0;
}
.uic-title-main h1 { margin: 0; }
.uic-title-sub {
  margin: 8px 0 0;
  color: var(--uic-muted);
  font-size: 15.5px;
  line-height: 1.55;
  max-width: 600px;
  /* Long short-descriptions stay tidy — max 2 lines. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.uic-title-sub:empty { display: none; }
