/* ==========================================================================
   Ordia Publish / Prepare Brief source candidate
   Publish-owned implementation CSS only.

   This file must not redefine shared foundation tokens.
   It consumes canonical Workspace Layout, Section Headers, Cards, Project Type
   Selectors, Questions, Controls, Helper Notes, Typography and Colour.
   ========================================================================== */

/* ==========================================================================
   PB-01 — Publish section composition
   ========================================================================== */

.pb-surface {
  display: grid;
  gap: var(--space-5, 20px);
  padding: var(--space-5, 20px);
  border-radius: var(--radius-lg, 16px);
}

.pb-surface--quiet {
  background: rgba(255,255,255,0.018);
}

.pb-section-head {
  display: grid;
  gap: var(--space-2, 8px);
  padding-bottom: var(--space-4, 16px);
  border-bottom: 1px solid var(--border-01, rgba(255,255,255,0.08));
}

.pb-section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3, 12px);
  min-width: 0;
}

.pb-section-title {
  margin: 0;
  color: var(--text-primary, #f2eee8);
  font-family: var(--serif, "DM Serif Display", serif);
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.06;
}

.pb-section-copy {
  max-width: 760px;
  margin: 0;
  color: var(--helper-text, #a9b6bd);
  font-family: var(--font, "DM Sans", sans-serif);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.52;
}

.pb-group {
  display: grid;
  gap: var(--space-3-5, 14px);
  min-width: 0;
}

.pb-group-label {
  margin: 0;
  color: var(--text-muted, rgba(255,255,255,0.68));
  font-family: var(--font, "DM Sans", sans-serif);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-transform: uppercase;
}

/* ==========================================================================
   Brief style selector consumption
   Publish consumes Project Type Selector tile anatomy. Only local spacing is
   allowed here; selector/tile/icon/copy/state chrome remains pt-* owned.
   ========================================================================== */

.pb-brief-style {
  display: grid;
  gap: var(--space-3-5, 14px);
  min-width: 0;
}

.pb-brief-style .pt-radio-tile__selected-mark {
  display: none;
}

/* ==========================================================================
   Supporting output composition
   Questions owns checkbox-choice chrome. Publish owns placement only.
   ========================================================================== */

.pb-supporting-output {
  display: grid;
  gap: var(--space-3, 12px);
  min-width: 0;
}

/* ==========================================================================
   PB-03 / PB-06 — Branding section and logo upload composition
   ========================================================================== */

.pb-branding-stack {
  display: grid;
  gap: 30px;
  min-width: 0;
}

.pb-branding-item {
  display: grid;
  gap: var(--space-3-5, 14px);
  min-width: 0;
  padding-top: var(--space-6, 24px);
  border-top: 1px solid var(--border-01, rgba(255,255,255,0.08));
}

.pb-branding-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.pb-branding-copy {
  display: grid;
  gap: 5px;
  max-width: 760px;
  min-width: 0;
}

.pb-branding-title {
  margin: 0;
  color: var(--text-primary, #f2eee8);
  font-family: var(--font, "DM Sans", sans-serif);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.pb-branding-text {
  margin: 0;
  color: var(--helper-text, #a9b6bd);
  font-family: var(--font, "DM Sans", sans-serif);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.52;
}

.pb-logo-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2-5, 10px);
  flex-wrap: wrap;
}

/* ==========================================================================
   PB-04 — Accent colour picker
   Swatch values are local Publish content values, not Colour foundation tokens.
   ========================================================================== */

.pb-colour-stack {
  display: grid;
  gap: var(--space-4, 16px);
  min-width: 0;
}

.pb-swatch-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: var(--space-2, 8px);
}

.pb-swatch {
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-md, 10px);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.16);
}

.pb-swatch.is-selected {
  outline: 2px solid var(--tab-active-underline, #FFC000);
  outline-offset: 2px;
}

.pb-colour-custom {
  display: grid;
  gap: var(--space-2, 8px);
  min-width: 0;
}

.pb-colour-custom-label {
  margin: 0;
  color: var(--helper-text, #a9b6bd);
  font-family: var(--font, "DM Sans", sans-serif);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}

.pb-colour-row {
  display: grid;
  grid-template-columns: 132px max-content max-content;
  gap: var(--space-2, 8px);
  align-items: center;
  justify-content: start;
}

.pb-hex-input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--border-01, rgba(255,255,255,0.08));
  border-radius: var(--radius-md, 10px);
  background: var(--surface-01, rgba(255,255,255,0.024));
  color: var(--text-primary, #f2eee8);
  font: 600 13px/1.3 var(--font, "DM Sans", sans-serif);
}

.pb-selected-colour {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-md, 10px);
  background: #1A1A2E;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.16);
}

.pb-reset-btn {
  min-height: 32px;
  padding-inline: 10px;
}

/* ==========================================================================
   PB-05 — Branding preview
   White preview surface is intentional: generated brief pages render on white.
   ========================================================================== */

.pb-brand-preview {
  display: grid;
  gap: var(--space-3, 12px);
}

.pb-brand-preview__page {
  display: grid;
  gap: var(--space-3, 12px);
  padding: 18px;
  border: 1px solid rgba(17,17,17,0.12);
  border-radius: 12px;
  background: #ffffff;
  color: #111111;
}

.pb-brand-preview__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3, 12px);
  min-height: 34px;
}

.pb-brand-preview__logo {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid rgba(17,17,17,0.10);
  border-radius: 9px;
  background: #ffffff;
  color: #111111;
  font-family: var(--serif, "DM Serif Display", serif);
  font-size: 20px;
  letter-spacing: -0.02em;
  line-height: 1;
}

.pb-brand-preview__meta {
  color: #1A1A2E;
  font-family: var(--font, "DM Sans", sans-serif);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.10em;
  line-height: 1.2;
  text-transform: uppercase;
}

.pb-brand-preview__title {
  margin: 0;
  color: #111111;
  font-family: var(--serif, "DM Serif Display", serif);
  font-size: 23px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.06;
}

.pb-brand-preview__rule {
  width: 100%;
  height: 4px;
  border-radius: var(--radius-pill, 999px);
  background: #1A1A2E;
}

.pb-brand-preview__copy {
  display: grid;
  gap: 7px;
}

.pb-brand-preview__line {
  height: 7px;
  border-radius: var(--radius-pill, 999px);
  background: rgba(17,17,17,0.12);
}

.pb-brand-preview__line.is-mid {
  width: 74%;
}

.pb-brand-preview__line.is-short {
  width: 52%;
}

.rebuild-document-placeholder {
  display: none;
}

.publish-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  padding: 1.5rem;
  overflow: hidden;
  background: rgba(8, 10, 12, 0.82);
}

.publish-preview-overlay .gbp-shell {
  width: min(1440px, calc(100vw - 3rem));
  max-height: calc(100vh - 3rem);
  margin: auto;
}

@media (max-width: 760px) {
  .publish-preview-overlay {
    padding: 0;
  }

  .publish-preview-overlay .gbp-shell {
    width: 100%;
    max-height: 100vh;
    min-height: 100vh;
  }

  .pb-swatch-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .pb-colour-row {
    grid-template-columns: 1fr;
  }

  .pb-logo-actions {
    align-items: stretch;
  }

  .pb-logo-action-button {
    width: 100%;
  }
}
