/* Ensemble Preview — Shared mock site styles (ep-* prefixed) */
/* Used by ensemble-preview.js across all tools + Compose */

/* === CSS Custom Property Declarations (set by JS, consumed by rules) === */
.ep-site {
  /* Colors */
  --ep-bg: #FDFBF7;
  --ep-nav-bg: #2C2416;
  --ep-nav-text: #FDFBF7;
  --ep-nav-accent: #E8C578;
  --ep-text: #2C2416;
  --ep-text-secondary: #6B5D4F;
  --ep-btn-primary-bg: #D6960A;
  --ep-btn-primary-text: #ffffff;
  --ep-btn-secondary-color: #0A4BD6;
  --ep-card-bg: #ffffff;
  --ep-card-text: #2C2416;
  --ep-card-border-1: #D6960A;
  --ep-card-border-2: #0A4BD6;
  --ep-card-border-3: #5D8AE9;
  --ep-footer-border: #E8C578;

  /* Typography */
  --ep-font-heading: 'Playfair Display', serif;
  --ep-font-body: 'Source Sans 3', sans-serif;
  --ep-font-size-heading: 1.75rem;
  --ep-font-size-body: 0.95rem;
  --ep-font-weight-heading: 700;

  /* Scale */
  --ep-base-size: 16px;
  --ep-scale-ratio: 1.25;
  --ep-spacing-base: 4px;

  /* Shadows */
  --ep-shadow-sm: 0 1px 2px 0 rgba(44, 36, 22, 0.12);
  --ep-shadow-md: 0 4px 6px -1px rgba(44, 36, 22, 0.12), 0 2px 4px -2px rgba(44, 36, 22, 0.07);
  --ep-shadow-lg: 0 10px 15px -3px rgba(44, 36, 22, 0.12), 0 4px 6px -4px rgba(44, 36, 22, 0.07);
  --ep-shadow-xl: 0 20px 25px -5px rgba(44, 36, 22, 0.12), 0 8px 10px -6px rgba(44, 36, 22, 0.07);

  /* Motion */
  --ep-easing: cubic-bezier(0.25, 0.1, 0.25, 1.0);
  --ep-duration: 0.3s;

  /* Grid */
  --ep-grid-cols: 12;
  --ep-grid-gap: 16px;
  --ep-grid-max: 1280px;
}

/* === Container & Frame === */
.ep-container {
  background: var(--surface-color, #0F0D24);
  border: 1px solid var(--border-color, rgba(167, 139, 250, 0.12));
  border-radius: 12px;
  overflow: hidden;
}

.ep-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-color, rgba(167, 139, 250, 0.12));
  background: var(--surface-color, #0F0D24);
}

.ep-header-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--secondary-text, #9B97B8);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ep-header-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ep-viewport-btn, .ep-theme-btn {
  background: transparent;
  border: 1px solid var(--border-color, rgba(167, 139, 250, 0.12));
  border-radius: 4px;
  padding: 0.2rem 0.4rem;
  font-size: 0.7rem;
  color: var(--muted-text, #6B6889);
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}

.ep-viewport-btn:hover, .ep-theme-btn:hover {
  border-color: var(--border-hover, rgba(167, 139, 250, 0.25));
  color: var(--body-text, #E2E0ED);
}

.ep-viewport-btn.active, .ep-theme-btn.active {
  background: var(--glow, rgba(167, 139, 250, 0.15));
  border-color: var(--primary-accent, #A78BFA);
  color: var(--primary-accent, #A78BFA);
}

.ep-divider {
  width: 1px;
  height: 14px;
  background: var(--border-color, rgba(167, 139, 250, 0.12));
  margin: 0 0.15rem;
}

/* === Viewport Frame === */
.ep-frame {
  overflow-y: auto;
  overflow-x: hidden;
  background: #e5e5e5;
  transition: max-width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ep-frame.desktop {
  max-width: 100%;
}

.ep-frame.tablet {
  max-width: 768px;
  margin: 0 auto;
  border-left: 1px solid var(--border-color, rgba(167, 139, 250, 0.12));
  border-right: 1px solid var(--border-color, rgba(167, 139, 250, 0.12));
}

.ep-frame.mobile {
  max-width: 375px;
  margin: 0 auto;
  border-left: 1px solid var(--border-color, rgba(167, 139, 250, 0.12));
  border-right: 1px solid var(--border-color, rgba(167, 139, 250, 0.12));
  border-radius: 0 0 20px 20px;
}

/* === Mock Site === */
.ep-site {
  min-height: 380px;
  font-family: var(--ep-font-body);
  font-size: var(--ep-font-size-body);
  background: var(--ep-bg);
  color: var(--ep-text);
}

/* Nav */
.ep-nav {
  padding: var(--ep-space-sm, 0.75rem) var(--ep-space-lg, 1.5rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--ep-nav-bg);
  color: var(--ep-nav-text);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.ep-nav-brand {
  font-family: var(--ep-font-heading);
  font-size: 1rem;
  font-weight: var(--ep-font-weight-heading);
}

.ep-nav-links {
  display: flex;
  gap: 1.25rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ep-nav-accent);
}

/* Hero */
.ep-hero {
  padding: var(--ep-space-xl, 2.5rem) var(--ep-space-lg, 1.5rem);
  text-align: center;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.ep-hero h2 {
  font-family: var(--ep-font-heading);
  font-size: var(--ep-font-size-heading);
  font-weight: var(--ep-font-weight-heading);
  margin-bottom: 0.6rem;
  color: var(--ep-text);
}

.ep-hero p {
  font-size: var(--ep-font-size-body);
  max-width: 420px;
  margin: 0 auto 1.25rem;
  opacity: 0.8;
  line-height: 1.7;
  color: var(--ep-text-secondary);
}

.ep-btn {
  display: inline-block;
  padding: 0.55rem 1.25rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  margin: 0 0.2rem;
  cursor: pointer;
  border: none;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform var(--ep-duration) var(--ep-easing), box-shadow var(--ep-duration) var(--ep-easing);
}

.ep-btn:hover {
  transform: translateY(-1px);
}

.ep-btn-primary {
  background: var(--ep-btn-primary-bg);
  color: var(--ep-btn-primary-text);
}

.ep-btn-primary {
  box-shadow: var(--ep-shadow-active, none);
}

.ep-btn-primary:hover {
  box-shadow: var(--ep-shadow-lg, var(--ep-shadow-md));
}

.ep-btn-secondary {
  background: transparent;
  color: var(--ep-btn-secondary-color);
  border: 2px solid var(--ep-btn-secondary-color);
}

/* Cards */
.ep-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--ep-space-md, 0.85rem);
  padding: 0 var(--ep-space-lg, 1.5rem) var(--ep-space-lg, 1.5rem);
}

.ep-card {
  padding: var(--ep-space-md, 1.1rem);
  border-radius: 8px;
  font-size: 0.8rem;
  background: var(--ep-card-bg);
  color: var(--ep-card-text);
  box-shadow: var(--ep-shadow-active, none);
  transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, transform var(--ep-duration) var(--ep-easing);
}

.ep-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--ep-shadow-lg, var(--ep-shadow-active, none));
}

.ep-card-1 { border-left: 3px solid var(--ep-card-border-1); }
.ep-card-2 { border-left: 3px solid var(--ep-card-border-2); }
.ep-card-3 { border-left: 3px solid var(--ep-card-border-3); }

.ep-card h3 {
  font-family: var(--ep-font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.ep-card p {
  opacity: 0.7;
  font-size: 0.75rem;
  line-height: 1.5;
}

/* Footer */
.ep-footer {
  padding: var(--ep-space-md, 0.85rem) var(--ep-space-lg, 1.5rem);
  text-align: center;
  font-size: 0.75rem;
  opacity: 0.5;
  border-top: 2px solid var(--ep-footer-border);
  color: var(--ep-text);
  transition: border-color 0.3s ease, color 0.3s ease;
}

/* === Scale Section === */
.ep-scale-section {
  padding: var(--ep-space-md, 1rem) var(--ep-space-lg, 1.5rem);
}

.ep-scale-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.ep-scale-label {
  font-size: 0.65rem;
  font-family: var(--ep-font-body);
  color: var(--ep-text-secondary);
  width: 2rem;
  text-align: right;
}

.ep-scale-fill {
  height: 6px;
  background: var(--ep-btn-primary-bg);
  border-radius: 3px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

/* === Shadow Section === */
.ep-shadow-section {
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Active shadow card — prominent display of selected level */
.ep-shadow-active-card {
  height: 72px;
  background: var(--ep-card-bg);
  border-radius: 8px;
  position: relative;
  transition: box-shadow 0.4s ease, background-color 0.3s ease;
  /* Ensure shadow is visible — slightly lighter bg than surrounding */
  filter: brightness(1.08);
}

.ep-shadow-level-label {
  position: absolute;
  bottom: 0.5rem;
  left: 0.75rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--ep-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
}

/* Sampler row — smaller, muted context */
.ep-shadow-sampler {
  display: flex;
  gap: 0.5rem;
}

.ep-shadow-card {
  flex: 1;
  min-width: 40px;
  height: 32px;
  background: var(--ep-card-bg);
  border-radius: 4px;
  position: relative;
  transition: box-shadow 0.3s ease, background-color 0.3s ease, opacity 0.3s ease;
  opacity: 0.5;
  /* Ensure shadow visibility on dark backgrounds */
  filter: brightness(1.12);
}

.ep-shadow-card.ep-shadow-selected {
  opacity: 1;
  outline: 2px solid var(--ep-btn-primary-bg);
  outline-offset: 2px;
}

.ep-shadow-card-label {
  position: absolute;
  bottom: 0.25rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.55rem;
  font-weight: 600;
  color: var(--ep-text-secondary);
  opacity: 0.6;
}

/* === Motion Section === */
.ep-motion-section {
  padding: var(--ep-space-md, 1rem) var(--ep-space-lg, 1.5rem);
  display: flex;
  gap: var(--ep-space-sm, 0.75rem);
}

.ep-motion-box {
  flex: 1;
  height: 40px;
  background: var(--ep-btn-primary-bg);
  border-radius: 6px;
  cursor: pointer;
  transition: transform var(--ep-duration) var(--ep-easing), box-shadow var(--ep-duration) var(--ep-easing);
}

.ep-motion-box:hover {
  transform: scale(1.05) translateY(-2px);
  box-shadow: var(--ep-shadow-md);
}

/* === Grid Section === */
.ep-grid-section {
  padding: var(--ep-space-md, 1rem) var(--ep-space-lg, 1.5rem);
}

.ep-grid {
  display: grid;
  gap: var(--ep-grid-gap);
  grid-template-columns: repeat(var(--ep-grid-cols), 1fr);
  max-width: var(--ep-grid-max);
}

.ep-grid-cell {
  height: 18px;
  background: var(--ep-btn-primary-bg);
  border-radius: 3px;
  opacity: 0.2;
  transition: opacity 0.2s ease;
}

.ep-grid-cell:nth-child(-n+4) { opacity: 0.5; }
.ep-grid-cell:first-child { opacity: 0.8; }

/* === Dark Mode Section === */
.ep-darkmode-section {
  padding: var(--ep-space-md, 1rem) var(--ep-space-lg, 1.5rem);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--ep-space-sm, 0.75rem);
}

.ep-darkmode-pane {
  padding: 1rem;
  border-radius: 8px;
  font-size: 0.75rem;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.ep-darkmode-pane h4 {
  font-family: var(--ep-font-heading);
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.ep-darkmode-pane p {
  opacity: 0.7;
  line-height: 1.5;
  font-size: 0.7rem;
}

.ep-darkmode-btn {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 0.5rem;
  border: none;
  cursor: default;
}

/* === Section Labels === */
.ep-section-label {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ep-text-secondary);
  padding: var(--ep-space-sm, 0.6rem) var(--ep-space-lg, 1.5rem) var(--ep-space-xs, 0.25rem);
  opacity: 0.6;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ep-default-badge {
  font-size: 0.55rem;
  color: var(--muted-text, #6B6889);
  background: rgba(107, 104, 137, 0.15);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* === Section Divider === */
.ep-section-divider {
  height: 1px;
  background: var(--ep-footer-border);
  opacity: 0.2;
  margin: 0 var(--ep-space-lg, 1.5rem);
}

/* === Animations === */

/* B1: Font loading shimmer */
.ep-loading .ep-hero h2,
.ep-loading .ep-hero p,
.ep-loading .ep-nav-brand,
.ep-loading .ep-card h3,
.ep-loading .ep-card p {
  opacity: 0.3;
  animation: ep-shimmer 1.2s ease infinite;
}

@keyframes ep-shimmer {
  50% { opacity: 0.15; }
}

/* B2: Highlight pulse on auto-scroll */
.ep-section-highlight {
  animation: ep-pulse 0.6s ease-out;
}

@keyframes ep-pulse {
  0% { box-shadow: inset 0 0 0 2px rgba(167, 139, 250, 0.4); }
  100% { box-shadow: inset 0 0 0 0 rgba(167, 139, 250, 0); }
}

/* === Below Controls Mode (auto-init, no toggle) === */
.ep-below-controls {
  max-height: 520px;
  overflow-y: auto;
  border: 1px solid var(--border-color, rgba(167, 139, 250, 0.12));
  border-radius: 12px;
  margin-bottom: 2rem;
}

@media (max-width: 640px) {
  .ep-below-controls { max-height: 380px; }
}

/* === Standalone Mode (individual tools) === */
.ep-standalone {
  margin-bottom: 1.5rem;
}

.ep-standalone .ep-frame {
  max-height: 500px;
}

/* === Panel Mode (Compose) === */
.ep-panel-container {
  position: fixed;
  top: 140px;
  right: 2rem;
  bottom: 2rem;
  width: calc(100vw - 316px - 520px - 4rem - 80px);
  min-width: 340px;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  background: var(--surface-color, #0F0D24);
  border: 1px solid var(--border-color, rgba(167, 139, 250, 0.12));
  border-radius: 12px;
  overflow: hidden;
  z-index: 10;
}

.ep-panel-container .ep-frame {
  flex: 1;
  overflow-y: auto;
}

.ep-panel-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-top: 1px solid var(--border-color, rgba(167, 139, 250, 0.12));
  font-size: 0.65rem;
  color: var(--muted-text, #6B6889);
}

.ep-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
}

/* === Toggle Button (for individual tools) === */
.ep-toggle-row {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.ep-toggle-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border-color, rgba(167, 139, 250, 0.12));
  border-radius: 6px;
  background: transparent;
  color: var(--muted-text, #6B6889);
  cursor: pointer;
  transition: all 0.15s;
}

.ep-toggle-btn:hover {
  border-color: var(--border-hover, rgba(167, 139, 250, 0.25));
  color: var(--body-text, #E2E0ED);
}

.ep-toggle-btn.active {
  background: var(--glow, rgba(167, 139, 250, 0.15));
  border-color: var(--primary-accent, #A78BFA);
  color: var(--primary-accent, #A78BFA);
}

/* === Mobile Cards (viewport) === */
.ep-frame.mobile .ep-cards,
.ep-frame.mobile .ep-darkmode-section {
  grid-template-columns: 1fr;
}

.ep-frame.mobile .ep-shadow-section {
  flex-direction: column;
}

.ep-frame.mobile .ep-grid {
  grid-template-columns: repeat(4, 1fr);
}

.ep-frame.tablet .ep-grid {
  grid-template-columns: repeat(6, 1fr);
}
