/* Theme showroom — contained sample-site preview (does not restyle CSMBAC shell) */

.theme-showroom {
  --ts-preview-min-h: 420px;
  --ts-chip-h: 44px;
  /* Active design-direction shell accents (chips indicator + toolbar). Default = Clean Professional. */
  --ts-shell-accent: #0d9488;
  --ts-shell-accent-fg: #ffffff;
  max-width: 1100px;
  margin: 0 auto 3rem;
  padding: 0 1rem;
  scroll-margin-top: calc(var(--nav-height, 72px) + 12px);
  overflow-x: clip;
}

.theme-showroom__head {
  text-align: center;
  margin-bottom: 1.25rem;
}

.theme-showroom__head h2 {
  margin: 0 0 0.5rem;
}

.theme-showroom__qualifier,
.theme-showroom__range {
  margin: 0.35rem auto 0;
  max-width: 52ch;
  color: var(--text-muted, #94a3b8);
  font-size: 0.95rem;
  line-height: 1.55;
}

.theme-showroom__chips-wrap {
  position: relative;
  margin-bottom: 0.75rem;
}

.theme-showroom__chips {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 0.25rem 0 0.5rem;
  position: relative;
  scrollbar-width: thin;
}

.theme-showroom__chip {
  /* Per-theme identity (set inline from theme_showroom.json variant). */
  --chip-accent: var(--ts-shell-accent);
  --chip-accent-fg: var(--ts-shell-accent-fg);
  flex: 0 0 auto;
  min-width: 44px;
  min-height: var(--ts-chip-h);
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1.5px solid var(--chip-accent);
  background: rgba(8, 12, 20, 0.78);
  color: var(--chip-accent);
  cursor: pointer;
  scroll-snap-align: start;
  touch-action: manipulation;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  position: relative;
  z-index: 1;
  transition:
    background var(--ts-motion-duration, 200ms) ease,
    border-color var(--ts-motion-duration, 200ms) ease,
    color var(--ts-motion-duration, 200ms) ease,
    box-shadow var(--ts-motion-duration, 200ms) ease;
}

@supports (background: color-mix(in srgb, red 50%, blue)) {
  .theme-showroom__chip {
    border-color: color-mix(in srgb, var(--chip-accent) 78%, transparent);
    background: color-mix(in srgb, var(--chip-accent) 14%, rgba(8, 12, 20, 0.88));
    color: color-mix(in srgb, var(--chip-accent) 72%, #f8fafc);
  }
}

.theme-showroom__chip:hover {
  border-color: var(--chip-accent);
  color: #f8fafc;
  background: rgba(8, 12, 20, 0.92);
}

@supports (background: color-mix(in srgb, red 50%, blue)) {
  .theme-showroom__chip:hover {
    background: color-mix(in srgb, var(--chip-accent) 24%, rgba(8, 12, 20, 0.9));
    color: color-mix(in srgb, var(--chip-accent) 35%, #ffffff);
  }
}

.theme-showroom__chip:focus-visible {
  outline: 2px solid var(--chip-accent);
  outline-offset: 2px;
}

.theme-showroom__chip[aria-selected="true"] {
  background: var(--chip-accent);
  border-color: var(--chip-accent);
  color: var(--chip-accent-fg);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

@supports (background: color-mix(in srgb, red 50%, blue)) {
  .theme-showroom__chip[aria-selected="true"] {
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--chip-accent) 40%, transparent),
      0 4px 14px color-mix(in srgb, var(--chip-accent) 32%, transparent);
  }
}

.theme-showroom__chip-short { display: inline; }
.theme-showroom__chip-full { display: none; }

.theme-showroom__chip-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  width: 48px;
  background: var(--ts-shell-accent);
  border-radius: 2px;
  transform: translateX(0);
  transition: transform var(--ts-motion-duration, 200ms) ease, width 200ms ease, background 200ms ease;
  pointer-events: none;
}

.theme-showroom__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.theme-showroom__device {
  display: none;
  gap: 0.35rem;
}

.theme-showroom__device-btn,
.theme-showroom__expand {
  min-height: 40px;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1.5px solid var(--ts-shell-accent);
  background: rgba(8, 12, 20, 0.78);
  color: var(--ts-shell-accent);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  touch-action: manipulation;
  transition:
    background var(--ts-motion-duration, 200ms) ease,
    border-color var(--ts-motion-duration, 200ms) ease,
    color var(--ts-motion-duration, 200ms) ease,
    box-shadow var(--ts-motion-duration, 200ms) ease;
}

@supports (background: color-mix(in srgb, red 50%, blue)) {
  .theme-showroom__device-btn,
  .theme-showroom__expand {
    border-color: color-mix(in srgb, var(--ts-shell-accent) 70%, transparent);
    background: color-mix(in srgb, var(--ts-shell-accent) 12%, rgba(8, 12, 20, 0.88));
    color: color-mix(in srgb, var(--ts-shell-accent) 65%, #f1f5f9);
  }
}

.theme-showroom__device-btn:hover,
.theme-showroom__expand:hover {
  border-color: var(--ts-shell-accent);
  color: #f8fafc;
  background: rgba(8, 12, 20, 0.92);
}

@supports (background: color-mix(in srgb, red 50%, blue)) {
  .theme-showroom__device-btn:hover,
  .theme-showroom__expand:hover {
    background: color-mix(in srgb, var(--ts-shell-accent) 22%, rgba(8, 12, 20, 0.9));
    color: color-mix(in srgb, var(--ts-shell-accent) 30%, #ffffff);
  }
}

.theme-showroom__device-btn:focus-visible,
.theme-showroom__expand:focus-visible {
  outline: 2px solid var(--ts-shell-accent);
  outline-offset: 2px;
}

.theme-showroom__device-btn.is-active {
  background: var(--ts-shell-accent);
  border-color: var(--ts-shell-accent);
  color: var(--ts-shell-accent-fg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

@supports (background: color-mix(in srgb, red 50%, blue)) {
  .theme-showroom__device-btn.is-active {
    box-shadow: 0 2px 10px color-mix(in srgb, var(--ts-shell-accent) 35%, transparent);
  }
}

.theme-showroom__live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.theme-showroom__preview-shell {
  min-height: var(--ts-preview-min-h);
  margin-bottom: 1rem;
}

.theme-showroom__preview {
  --ts-page-bg: #f8fafc;
  --ts-surface: #fff;
  --ts-text: #0f172a;
  --ts-muted: #64748b;
  --ts-accent: #0d9488;
  --ts-accent-fg: #fff;
  --ts-nav-bg: #fff;
  --ts-nav-fg: #0f172a;
  --ts-border: #e2e8f0;
  --ts-card-bg: #fff;
  --ts-radius: 12px;
  --ts-font-display: inherit;
  --ts-font-body: inherit;
  --ts-hero-overlay: none;
  --ts-object-position: center;
  --ts-filter: none;
  --ts-motion-duration: 260ms;
  --ts-motion-easing: ease-out;
  --ts-stagger: 40ms;

  background: var(--ts-page-bg);
  color: var(--ts-text);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 16px;
  overflow: hidden;
  min-height: var(--ts-preview-min-h);
  font-family: var(--ts-font-body);
  transition: opacity var(--ts-motion-duration) var(--ts-motion-easing);
}

.theme-showroom__preview.is-theme-transitioning {
  will-change: opacity, transform;
}

.theme-showroom__preview.is-device-mobile {
  max-width: 390px;
  margin-inline: auto;
  border-radius: 28px;
  box-shadow: 0 0 0 8px rgba(15, 23, 42, 0.55);
}

.theme-showroom__demo-banner {
  margin: 0;
  padding: 0.4rem 0.75rem;
  background: rgba(0, 0, 0, 0.55);
  color: #f8fafc;
  font-size: 0.72rem;
  text-align: center;
}

/* Sample nav */
.ts-sample-nav {
  background: var(--ts-nav-bg);
  color: var(--ts-nav-fg);
  border-bottom: 1px solid var(--ts-border);
}

.ts-sample-nav__quote-bar {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  background: var(--ts-accent);
  color: var(--ts-accent-fg);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: max-height var(--ts-motion-duration) var(--ts-motion-easing), opacity var(--ts-motion-duration) var(--ts-motion-easing);
}

.ts-sample-nav[data-nav-layout="corporate-bar"] .ts-sample-nav__quote-bar {
  max-height: 36px;
  opacity: 1;
  padding: 0.35rem 0.5rem;
}

.ts-sample-nav__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
}

.ts-sample-nav__logo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--ts-font-display);
  font-weight: 700;
  font-size: 0.85rem;
}

.ts-sample-nav__mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: calc(var(--ts-radius) * 0.8);
  background: var(--ts-accent);
  color: var(--ts-accent-fg);
  font-size: 0.7rem;
}

.ts-sample-nav__links {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0.75rem;
  justify-content: center;
}

.ts-sample-nav__links a {
  color: inherit;
  text-decoration: none;
  font-size: 0.78rem;
}

.ts-sample-nav__cta {
  display: none;
  border: 0;
  background: var(--ts-accent);
  color: var(--ts-accent-fg);
  border-radius: var(--ts-radius);
  padding: 0.35rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: default;
}

.ts-sample-nav__burger {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor, 0 -5px 0 currentColor;
  justify-self: end;
}

.theme-showroom__preview.is-device-desktop .ts-sample-nav__links,
.theme-showroom__preview.is-device-desktop .ts-sample-nav__cta {
  display: flex;
}

.theme-showroom__preview.is-device-desktop .ts-sample-nav__burger {
  display: none;
}

.ts-sample-nav[data-nav-layout="editorial-centre"] .ts-sample-nav__inner {
  grid-template-columns: 1fr;
  text-align: center;
  justify-items: center;
}

.ts-sample-nav[data-nav-layout="editorial-centre"] .ts-sample-nav__links {
  order: 2;
}

.ts-sample-nav[data-nav-layout="bold-compact"] {
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--ts-accent), transparent) 1;
}

.ts-sample-nav[data-nav-layout="creative-soft"] .ts-sample-nav__cta,
.ts-sample-nav[data-nav-layout="creative-soft"] .ts-sample-nav__links a {
  border-radius: 999px;
}

.ts-sample-nav[data-nav-layout="local-warm"] .ts-sample-nav__mark {
  border-radius: 999px;
}

/* Hero */
.ts-sample-hero {
  display: grid;
  gap: 0.75rem;
  padding: 1rem 0.85rem;
}

.ts-sample-hero__eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ts-muted);
}

.ts-sample-hero__title {
  margin: 0 0 0.4rem;
  font-family: var(--ts-font-display);
  font-size: clamp(1.15rem, 3.5vw, 1.65rem);
  line-height: 1.2;
  color: var(--ts-text);
}

.ts-sample-hero__sub {
  margin: 0 0 0.75rem;
  color: var(--ts-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.ts-sample-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.ts-sample-btn {
  border: 1px solid transparent;
  border-radius: var(--ts-radius);
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: default;
}

.ts-sample-btn--primary {
  background: var(--ts-accent);
  color: var(--ts-accent-fg);
}

.ts-sample-btn--ghost {
  background: transparent;
  border-color: var(--ts-accent);
  color: var(--ts-accent);
}

.ts-sample-hero__media {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--ts-radius);
  overflow: hidden;
  background: #1e293b;
}

.ts-sample-hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--ts-object-position);
  filter: var(--ts-filter);
  display: block;
}

.ts-sample-hero__overlay {
  position: absolute;
  inset: 0;
  background: var(--ts-hero-overlay);
  pointer-events: none;
}

.theme-showroom__preview[data-layout="editorial-centre"] .ts-sample-hero {
  text-align: center;
}

.theme-showroom__preview[data-layout="editorial-centre"] .ts-sample-hero__actions {
  justify-content: center;
}

.theme-showroom__preview[data-layout="bold-asymmetric"] .ts-sample-hero__copy {
  order: 2;
}

.ts-sample-services {
  display: grid;
  gap: 0.65rem;
  padding: 0 0.85rem 1rem;
}

.ts-sample-card {
  background: var(--ts-card-bg);
  border: 1px solid var(--ts-border);
  border-radius: var(--ts-radius);
  padding: 0.75rem;
  transition: transform var(--ts-motion-duration) var(--ts-motion-easing), opacity var(--ts-motion-duration) var(--ts-motion-easing);
  transition-delay: calc(var(--ts-i, 0) * var(--ts-stagger));
}

.ts-sample-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Fallback before data-surface rules; never rely on accent alone */
  color: var(--ts-icon, var(--ts-text, #f1f5f9));
  margin-bottom: 0.35rem;
}

/* Explicit ink: dark themes must never inherit near-black strokes */
.theme-showroom__preview[data-surface="dark"] .ts-sample-card__icon,
.theme-showroom__preview:not([data-theme="clean-professional"]) .ts-sample-card__icon {
  color: #f1f5f9 !important;
}

.theme-showroom__preview[data-surface="light"] .ts-sample-card__icon,
.theme-showroom__preview[data-theme="clean-professional"] .ts-sample-card__icon {
  color: #0f172a !important;
}

.ts-sample-card__icon svg,
.ts-sample-card__svg {
  width: 24px;
  height: 24px;
  display: block;
  flex: 0 0 auto;
  stroke: currentColor !important;
  fill: none;
  color: inherit;
}

.ts-sample-card__icon svg *,
.ts-sample-card__svg * {
  stroke: currentColor !important;
  fill: none;
}

/* Stale markup fallback: <img src="*.svg"> ignores currentColor — recolor by surface */
.ts-sample-card__icon img {
  width: 24px;
  height: 24px;
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
}

.theme-showroom__preview[data-surface="dark"] .ts-sample-card__icon img,
.theme-showroom__preview:not([data-theme="clean-professional"]) .ts-sample-card__icon img {
  /* Black SVG strokes → light ink on dark cards */
  filter: brightness(0) invert(1);
  opacity: 0.95;
}

.theme-showroom__preview[data-surface="light"] .ts-sample-card__icon img,
.theme-showroom__preview[data-theme="clean-professional"] .ts-sample-card__icon img {
  /* Keep dark strokes on light cards */
  filter: brightness(0);
  opacity: 0.82;
}

.ts-sample-card h3 {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  font-family: var(--ts-font-display);
}

.ts-sample-card p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ts-muted);
  line-height: 1.45;
}

.theme-showroom__preview[data-layout="bold-asymmetric"] .ts-sample-card {
  border-left: 3px solid var(--ts-accent);
}

.ts-sample-proof {
  padding: 0 0.85rem 1rem;
}

.ts-sample-proof blockquote {
  margin: 0 0 0.75rem;
  font-family: var(--ts-font-display);
  font-style: italic;
  font-size: 0.92rem;
  color: var(--ts-text);
}

.ts-sample-proof cite {
  display: block;
  margin-top: 0.35rem;
  font-style: normal;
  font-size: 0.75rem;
  color: var(--ts-muted);
}

.ts-sample-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.ts-sample-trust li {
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--ts-border);
  font-size: 0.72rem;
  color: var(--ts-muted);
}

.ts-sample-enquiry {
  margin: 0 0.85rem 1rem;
  padding: 0.85rem;
  background: var(--ts-surface);
  border-radius: var(--ts-radius);
  border: 1px solid var(--ts-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.ts-sample-enquiry p {
  margin: 0;
  font-weight: 600;
  font-family: var(--ts-font-display);
}

.ts-sample-footer {
  padding: 0.65rem 0.85rem;
  font-size: 0.72rem;
  color: var(--ts-muted);
  border-top: 1px solid var(--ts-border);
}

.theme-showroom__actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}

.theme-showroom__actions .btn-primary,
.theme-showroom__actions .btn-secondary {
  text-align: center;
  justify-content: center;
}

.theme-showroom__noscript {
  color: var(--text-muted, #94a3b8);
  font-size: 0.9rem;
}

/* Fullscreen modal */
.theme-showroom-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(2, 6, 23, 0.88);
  display: grid;
  place-items: center;
  padding: 0.75rem;
}

.theme-showroom-modal[hidden] {
  display: none !important;
}

.theme-showroom-modal__panel {
  width: min(1200px, 100%);
  max-height: 90dvh;
  overflow: auto;
  background: #0b1220;
  border-radius: 16px;
  padding: 0.75rem;
  position: relative;
}

.theme-showroom-modal__close {
  position: sticky;
  top: 0;
  float: right;
  z-index: 2;
  min-height: 40px;
  min-width: 40px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  cursor: pointer;
}

@media (min-width: 640px) {
  .theme-showroom {
    --ts-preview-min-h: 460px;
  }

  .theme-showroom__device {
    display: inline-flex;
  }

  .theme-showroom__chip-short { display: none; }
  .theme-showroom__chip-full { display: inline; }

  .theme-showroom__chips {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    overflow: visible;
    scroll-snap-type: none;
  }

  .theme-showroom__chip {
    width: 100%;
  }

  .theme-showroom__actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .theme-showroom__preview.is-device-desktop .ts-sample-hero {
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }

  .theme-showroom__preview.is-device-desktop .ts-sample-services {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1100px) {
  .theme-showroom {
    --ts-preview-min-h: 500px;
  }

  .theme-showroom__chips {
    grid-template-columns: repeat(6, 1fr);
  }

  .theme-showroom__preview-shell {
    display: flex;
    justify-content: center;
  }

  .theme-showroom__preview.is-device-desktop {
    width: min(920px, 100%);
  }
}

@media (max-width: 639px) {
  .theme-showroom__device {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-showroom,
  .theme-showroom * {
    --ts-motion-duration: 0ms !important;
    --ts-stagger: 0ms !important;
    transition: none !important;
    animation: none !important;
  }

  .theme-showroom__chip-indicator {
    transition: none !important;
  }
}
