/* Website Builder - "website builder" card, 2026-08-23. Theme values are
   applied as CSS custom properties on :root by site_builder.js
   (applyTheme()) - the --sb-* variables below have fallbacks matching
   site_builder.py's _default_state() so a page still looks right before
   the JS has fetched the real state. */
:root {
  --sb-primary: #c9a227;
  --sb-secondary: #e8ca6e;
  --sb-bg: #0a0e17;
  --sb-surface: #131a2b;
  --sb-text: #f3efe2;
  --sb-font-heading: Georgia, 'Times New Roman', serif;
  --sb-font-body: 'Segoe UI', system-ui, sans-serif;
}

/* ---------- Shared module rendering (public page + editor preview) ---------- */

.sb-public-page {
  max-width: 1100px;
  margin: 0 auto;
  /* 74px top clears .topnav's fixed height (landing.css) - every other
     site_*.html page gets the same clearance via its own .page-hero's
     top padding; this page has no hero banner, so it needs its own. */
  padding: calc(74px + 2.5rem) 1.5rem 4rem;
}

.sb-page-empty {
  text-align: center;
  color: var(--sb-text);
  opacity: 0.7;
  padding: 4rem 1rem;
  font-family: var(--sb-font-body);
}

.sb-section {
  margin-bottom: 2.25rem;
}

/* A generic (non-full-bleed) section rendered directly on the home page, or
   on one of the other migrated hand-built pages (site_page.html's own
   .sb-full-page - "onboard my other pages" card follow-up, 2026-08-23) -
   full-bleed modules (hero/stats/feature-cards/testimonials/cta/page-hero/
   team/process-steps, see site_builder.js's LAYOUT_TYPES) render their own
   <header>/<div>/<section> with no .sb-section class, so this doesn't touch
   them; a plain text/image/etc. section added alongside them still needs
   SOME width constraint, since .sb-home-page/.sb-full-page are themselves
   intentionally unconstrained (that's what lets the full-bleed ones span
   the viewport). */
.sb-home-page > .sb-section, .sb-full-page > .sb-section {
  max-width: 1100px;
  margin: 0 auto 2.25rem;
  padding: 0 1.5rem;
}

.sb-grid {
  display: grid;
  gap: 1.25rem;
}

.sb-cell {
  min-height: 60px;
}

.sb-module-empty {
  color: var(--sb-text);
  opacity: 0.5;
  font-family: var(--sb-font-body);
  font-style: italic;
  font-size: 0.9rem;
}

.sb-module-text h2, .sb-module-text h3 {
  font-family: var(--sb-font-heading);
  color: var(--sb-secondary);
  margin: 0 0 0.5rem;
}

.sb-module-text p {
  font-family: var(--sb-font-body);
  color: var(--sb-text);
  white-space: pre-wrap;
  margin: 0;
  line-height: 1.6;
}

.sb-module-image img {
  max-width: 100%;
  border-radius: 4px;
  display: block;
}

.sb-module-image figcaption,
.sb-module-slideshow figcaption,
.sb-module-video figcaption {
  font-family: var(--sb-font-body);
  color: var(--sb-text);
  opacity: 0.75;
  font-size: 0.85rem;
  margin-top: 0.4rem;
}

.sb-slideshow {
  position: relative;
}

.sb-slideshow-track {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background: var(--sb-surface);
  min-height: 160px;
}

.sb-slide {
  display: none;
}

.sb-slide.sb-slide-active {
  display: block;
}

.sb-slide img {
  width: 100%;
  display: block;
}

.sb-slideshow-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.sb-slideshow-controls button {
  background: var(--sb-surface);
  color: var(--sb-text);
  border: 1px solid var(--sb-primary);
  border-radius: 3px;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  font-family: var(--sb-font-body);
}

.sb-slideshow-dots {
  display: flex;
  gap: 0.35rem;
}

.sb-slideshow-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sb-surface);
  border: 1px solid var(--sb-primary);
  display: inline-block;
  cursor: pointer;
}

.sb-slideshow-dots span.sb-dot-active {
  background: var(--sb-primary);
}

.sb-module-video video, .sb-module-video iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 4px;
  display: block;
  background: #000;
}

.sb-module-qa {
  font-family: var(--sb-font-body);
}

.sb-qa-item {
  border: 1px solid var(--sb-primary);
  border-radius: 4px;
  margin-bottom: 0.6rem;
  background: var(--sb-surface);
  overflow: hidden;
}

.sb-qa-item summary {
  cursor: pointer;
  padding: 0.7rem 1rem;
  color: var(--sb-secondary);
  font-weight: 600;
  list-style: none;
}

.sb-qa-item summary::-webkit-details-marker {
  display: none;
}

.sb-qa-item summary::before {
  content: '+ ';
  color: var(--sb-primary);
}

.sb-qa-item[open] summary::before {
  content: '– ';
}

.sb-qa-item .sb-qa-answer {
  padding: 0 1rem 0.9rem;
  color: var(--sb-text);
  white-space: pre-wrap;
  opacity: 0.9;
}

/* ---------- Admin editor chrome ---------- */

.sb-app:empty { display: none; }

.sb-editor {
  display: flex;
  align-items: flex-start;
  font-family: var(--sb-font-body);
}

.sb-sidebar {
  position: sticky;
  top: 0;
  width: 300px;
  flex: 0 0 300px;
  max-height: 100vh;
  overflow-y: auto;
  background: var(--sb-surface);
  border-right: 1px solid var(--sb-primary);
  padding: 1.25rem 1rem 3rem;
  color: var(--sb-text);
}

.sb-canvas {
  flex: 1 1 auto;
  min-width: 0;
  padding: 1.5rem 2rem 4rem;
  background: var(--sb-bg);
}

.sb-below-builder {
  padding: 1.5rem;
}

.sb-sidebar h4 {
  color: var(--sb-secondary);
  font-family: var(--sb-font-heading);
  margin: 1.4rem 0 0.5rem;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sb-sidebar h4:first-child { margin-top: 0; }

.sb-page-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sb-page-list li {
  margin-bottom: 0.25rem;
}

.sb-page-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.sb-page-link {
  flex: 1 1 auto;
  background: none;
  border: 1px solid transparent;
  color: var(--sb-text);
  text-align: left;
  padding: 0.35rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: var(--sb-font-body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-page-link.sb-page-active {
  border-color: var(--sb-primary);
  color: var(--sb-secondary);
  background: rgba(201, 162, 39, 0.12);
}

.sb-page-sub-list {
  list-style: none;
  margin: 0 0 0 1rem;
  padding: 0;
}

.sb-icon-btn {
  background: none;
  border: none;
  color: var(--sb-text);
  opacity: 0.7;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.2rem 0.35rem;
}

.sb-icon-btn:hover { opacity: 1; }

.sb-btn {
  font-family: var(--sb-font-body);
  border-radius: 3px;
  border: 1px solid var(--sb-primary);
  background: transparent;
  color: var(--sb-text);
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.sb-btn:hover { background: rgba(201, 162, 39, 0.15); }

.sb-btn-primary {
  background: var(--sb-primary);
  color: #14140f;
  font-weight: 600;
}

.sb-btn-primary:hover { background: var(--sb-secondary); }

.sb-btn-danger {
  border-color: #d9534f;
  color: #ff8f8b;
}

.sb-btn-block {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  text-align: center;
}

.sb-field {
  display: block;
  font-size: 0.8rem;
  color: var(--sb-text);
  opacity: 0.85;
  margin-bottom: 0.6rem;
}

.sb-input, .sb-textarea, select.sb-input {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  background: var(--sb-bg);
  border: 1px solid var(--sb-primary);
  color: var(--sb-text);
  border-radius: 3px;
  padding: 0.4rem 0.5rem;
  font-family: var(--sb-font-body);
  font-size: 0.9rem;
}

.sb-textarea {
  min-height: 80px;
  resize: vertical;
}

.sb-color-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.sb-color-row input[type="color"] {
  width: 32px;
  height: 28px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

.sb-color-row label {
  flex: 1 1 auto;
  font-size: 0.8rem;
  color: var(--sb-text);
  opacity: 0.85;
}

.sb-save-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--sb-primary);
}

.sb-save-status {
  font-size: 0.8rem;
  opacity: 0.75;
  color: var(--sb-text);
}

.sb-canvas-page-title {
  font-family: var(--sb-font-heading);
  color: var(--sb-secondary);
  margin-top: 0;
}

.sb-page-meta {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.sb-page-meta .sb-field { margin-bottom: 0; flex: 1 1 180px; }

.sb-editable-section {
  border: 1px dashed rgba(201, 162, 39, 0.5);
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1.25rem;
  position: relative;
}

.sb-section-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.sb-section-toolbar .sb-grid-config {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--sb-text);
}

.sb-section-toolbar .sb-grid-config input {
  width: 44px;
  background: var(--sb-bg);
  border: 1px solid var(--sb-primary);
  color: var(--sb-text);
  border-radius: 3px;
  padding: 0.2rem 0.3rem;
}

.sb-editable-cell {
  border: 1px dashed rgba(243, 239, 226, 0.25);
  border-radius: 4px;
  padding: 0.75rem;
  position: relative;
}

.sb-cell-empty-btn {
  width: 100%;
  height: 100%;
  min-height: 70px;
  background: none;
  border: none;
  color: var(--sb-text);
  opacity: 0.5;
  cursor: pointer;
  font-size: 1.4rem;
}

.sb-cell-empty-btn:hover { opacity: 0.9; }

.sb-module-toolbar {
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
  margin-bottom: 0.4rem;
}

.sb-edit-form label { display: block; margin-bottom: 0.5rem; }
.sb-edit-form .sb-edit-actions { margin-top: 0.5rem; display: flex; gap: 0.5rem; }

.sb-slide-edit-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.sb-slide-edit-row img {
  width: 60px;
  height: 40px;
  object-fit: cover;
  border-radius: 3px;
}

.sb-slide-edit-row input.sb-input { flex: 1 1 auto; }

.sb-qa-edit-row {
  border: 1px solid rgba(243, 239, 226, 0.2);
  border-radius: 4px;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
}

.sb-hidden { display: none !important; }

.sb-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 10, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.sb-modal {
  background: var(--sb-surface);
  border: 1px solid var(--sb-primary);
  border-radius: 6px;
  width: min(420px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  color: var(--sb-text);
  font-family: var(--sb-font-body);
}

.sb-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--sb-primary);
}

.sb-modal-head h3 {
  margin: 0;
  font-family: var(--sb-font-heading);
  color: var(--sb-secondary);
  font-size: 1.1rem;
}

.sb-modal-close {
  background: none;
  border: none;
  color: var(--sb-text);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
}

.sb-modal-body { padding: 1rem; }

.sb-hint { font-size: 0.8rem; opacity: 0.7; margin-top: 0.5rem; }

.sb-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.sb-module-type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.sb-module-type-btn {
  background: var(--sb-bg);
  border: 1px solid var(--sb-primary);
  color: var(--sb-text);
  border-radius: 4px;
  padding: 0.9rem 0.5rem;
  cursor: pointer;
  text-align: center;
  font-size: 0.85rem;
}

.sb-module-type-btn:hover { background: rgba(201, 162, 39, 0.15); }

/* ---------- Full-bleed section editing (hero/stats/feature-cards/
   testimonials/cta) - the real page markup rendered underneath, with a
   slim toolbar above instead of the dashed generic-grid chrome, so the
   editor actually looks like the site it's editing. ---------- */

.sb-fullbleed-section {
  margin-bottom: 1.5rem;
  border: 1px dashed rgba(201, 162, 39, 0.5);
  border-radius: 4px;
  overflow: hidden;
}

.sb-fullbleed-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  background: var(--sb-surface);
  border-bottom: 1px dashed rgba(201, 162, 39, 0.5);
}

.sb-fullbleed-label {
  flex: 1 1 auto;
  font-family: var(--sb-font-heading);
  color: var(--sb-secondary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sb-fullbleed-preview {
  pointer-events: auto;
}

@media (max-width: 800px) {
  .sb-editor { flex-direction: column; }
  .sb-sidebar {
    position: static;
    width: 100%;
    flex-basis: auto;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--sb-primary);
  }
  .sb-canvas { padding: 1.25rem 1rem 3rem; }
}
