/*
 * Product surface
 * ------------------------------------------------------------------------
 * The fixture UI intentionally demonstrates many possible Loom concepts.
 * Gateway-backed product screens must instead behave like one quiet operating
 * desk: a single content measure, a smaller reading measure, and a repeated
 * 8px rhythm.  Keep this file last in the cascade so legacy fixture rules
 * cannot change the proportions of real product routes.
 */

.app-shell[data-product-mode='true'] {
  --product-content: 1040px;
  --product-reading: 760px;
  --product-gap: 24px;
  --product-panel-padding: 24px;
}

.app-shell[data-product-mode='true'] .sidebar {
  padding: 24px 16px;
}

.app-shell[data-product-mode='true'] .main {
  padding: 28px clamp(24px, 5vw, 80px) 80px;
}

.app-shell[data-product-mode='true'] .topbar {
  width: min(var(--product-content), 100%);
  min-height: 28px;
  margin: 0 auto 36px;
}

/* Before a person has an authenticated Node there is no meaningful Space rail.
   Use the full canvas for the one action rather than leaving a decorative
   navigation column beside it. */
.app-shell[data-product-mode='true'][data-product-phase='signed-out'],
.app-shell[data-product-mode='true'][data-product-phase='loading'],
.app-shell[data-product-mode='true'][data-product-phase='loading-entry'],
.app-shell[data-product-mode='true'][data-product-phase='ready'],
.app-shell[data-product-mode='true'][data-product-phase='submitting-onboarding'],
.app-shell[data-product-mode='true'][data-product-phase='submitting-space-create'] {
  grid-template-columns: minmax(0, 1fr);
}

.app-shell[data-product-mode='true'][data-product-phase='signed-out'] .sidebar,
.app-shell[data-product-mode='true'][data-product-phase='loading'] .sidebar,
.app-shell[data-product-mode='true'][data-product-phase='loading-entry'] .sidebar,
.app-shell[data-product-mode='true'][data-product-phase='ready'] .sidebar,
.app-shell[data-product-mode='true'][data-product-phase='submitting-onboarding'] .sidebar,
.app-shell[data-product-mode='true'][data-product-phase='submitting-space-create'] .sidebar {
  display: none;
}

.app-shell[data-product-mode='true'] .btn {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.2;
}

.app-shell[data-product-mode='true'] .btn--quiet {
  color: var(--text-soft);
  background: transparent;
  border-color: transparent;
}

.app-shell[data-product-mode='true'] .btn--quiet:hover {
  color: var(--violet-deep);
  background: var(--violet-wash);
  border-color: transparent;
}

.app-shell[data-product-mode='true'] .btn:focus-visible,
.app-shell[data-product-mode='true'] input:focus-visible,
.app-shell[data-product-mode='true'] textarea:focus-visible,
.app-shell[data-product-mode='true'] select:focus-visible,
.app-shell[data-product-mode='true'] summary:focus-visible {
  outline: 0;
  box-shadow: var(--focus-ring);
}

/* First entry: a focused identity action, not a mostly empty two-column card. */
.app-shell[data-product-mode='true'] .product-onboarding {
  width: min(960px, 100%);
  grid-template-columns: minmax(0, .9fr) minmax(320px, 1.1fr);
  gap: 40px;
  margin: clamp(28px, 7vh, 72px) auto 32px;
  padding: clamp(28px, 4vw, 48px);
  border-radius: 18px;
  box-shadow: 0 12px 34px rgba(31, 28, 51, .06);
}

.app-shell[data-product-mode='true'] .product-onboarding--status {
  display: block;
  width: min(620px, 100%);
  margin-top: clamp(52px, 13vh, 140px);
  padding: clamp(32px, 5vw, 56px);
}

.app-shell[data-product-mode='true'] .product-onboarding__copy h1 {
  max-width: 15ch;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.12;
}

.app-shell[data-product-mode='true'] .product-onboarding--status .product-onboarding__copy {
  padding: 0;
}

.app-shell[data-product-mode='true'] .product-onboarding--status .product-onboarding__copy h1 {
  max-width: 13ch;
}

.app-shell[data-product-mode='true'] .product-onboarding__copy > p:not(.eyebrow) {
  max-width: 44ch;
  margin-top: 16px;
}

.app-shell[data-product-mode='true'] .product-onboarding__content {
  padding: 20px;
  border-radius: 12px;
}

.app-shell[data-product-mode='true'] .product-onboarding__pending,
.app-shell[data-product-mode='true'] .product-onboarding__secondary-action {
  width: min(960px, 100%);
  margin-bottom: 32px;
}

/* Shared page rhythm. A heading, a slim fact strip, and panels all share the
   same content width instead of independently choosing 760/820/1080/1120px. */
.app-shell[data-product-mode='true'] .product-space-heading,
.app-shell[data-product-mode='true'] .product-space-summary,
.app-shell[data-product-mode='true'] .product-space-grid,
.app-shell[data-product-mode='true'] .product-task-section,
.app-shell[data-product-mode='true'] .product-task-facts,
.app-shell[data-product-mode='true'] .product-task-actions,
.app-shell[data-product-mode='true'] .product-space-management,
.app-shell[data-product-mode='true'] .product-conversation-section,
.app-shell[data-product-mode='true'] .product-origin-notice {
  width: min(var(--product-content), 100%);
  max-width: none;
}

.app-shell[data-product-mode='true'] .product-space-heading {
  align-items: end;
  gap: var(--product-gap);
  padding: 0 0 24px;
}

.app-shell[data-product-mode='true'] .product-space-heading h1 {
  max-width: 18ch;
  font-size: clamp(32px, 4vw, 46px);
  line-height: 1.14;
}

.app-shell[data-product-mode='true'] .product-space-heading p:not(.eyebrow) {
  max-width: 56ch;
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.68;
}

.app-shell[data-product-mode='true'] .product-space-summary {
  margin-bottom: var(--product-gap);
  border-radius: 12px;
  box-shadow: none;
}

.app-shell[data-product-mode='true'] .product-space-summary > div {
  padding: 16px 18px;
}

.app-shell[data-product-mode='true'] .product-space-summary strong {
  font-size: 18px;
}

.app-shell[data-product-mode='true'] .product-space-grid {
  gap: var(--product-gap);
  margin-bottom: var(--product-gap);
}

.app-shell[data-product-mode='true'] .product-space-section,
.app-shell[data-product-mode='true'] .product-task-actions,
.app-shell[data-product-mode='true'] .product-composer,
.app-shell[data-product-mode='true'] .product-message-composer {
  padding: var(--product-panel-padding);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(31, 28, 51, .045);
}

.app-shell[data-product-mode='true'] .product-space-section h2,
.app-shell[data-product-mode='true'] .product-task-actions h2 {
  font-size: 19px;
  line-height: 1.3;
}

.app-shell[data-product-mode='true'] .card__heading {
  padding-bottom: 16px;
}

.app-shell[data-product-mode='true'] .product-task-section,
.app-shell[data-product-mode='true'] .product-task-actions,
.app-shell[data-product-mode='true'] .product-space-management {
  margin-top: 0;
  margin-bottom: var(--product-gap);
}

.app-shell[data-product-mode='true'] .product-task-facts {
  gap: 8px;
  margin-bottom: var(--product-gap);
}

.app-shell[data-product-mode='true'] .product-task-facts > div {
  padding: 14px 16px;
  border-radius: 10px;
}

.app-shell[data-product-mode='true'] .product-task-facts strong {
  font-size: 15px;
}

/* Forms have one field measure and one action line. Native select arrows are
   drawn at a fixed inset rather than inheriting browser-specific baselines. */
.app-shell[data-product-mode='true'] .product-action-composer,
.app-shell[data-product-mode='true'] .product-composer,
.app-shell[data-product-mode='true'] .product-message-composer {
  width: min(var(--product-reading), 100%);
  max-width: none;
  margin-right: auto;
  margin-left: auto;
}

.app-shell[data-product-mode='true'] .product-action-composer {
  gap: 16px;
  padding: 20px;
  margin-top: 20px;
  background: var(--surface);
}

.app-shell[data-product-mode='true'] .product-action-composer textarea,
.app-shell[data-product-mode='true'] .product-action-composer select,
.app-shell[data-product-mode='true'] .product-composer input,
.app-shell[data-product-mode='true'] .product-composer textarea,
.app-shell[data-product-mode='true'] .product-message-composer textarea,
.app-shell[data-product-mode='true'] .product-answer-form textarea,
.app-shell[data-product-mode='true'] .product-proposal-actions textarea,
.app-shell[data-product-mode='true'] .product-handoff-transition textarea,
.app-shell[data-product-mode='true'] .product-join-request__actions textarea {
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 14px;
}

.app-shell[data-product-mode='true'] .product-action-composer textarea,
.app-shell[data-product-mode='true'] .product-composer textarea,
.app-shell[data-product-mode='true'] .product-message-composer textarea {
  min-height: 128px;
}

.app-shell[data-product-mode='true'] .product-action-composer select {
  appearance: none;
  min-height: 42px;
  padding-right: 42px;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23676a7b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.75'/%3E%3C/svg%3E");
  background-position: right 15px center;
  background-repeat: no-repeat;
  background-size: 12px 8px;
}

.app-shell[data-product-mode='true'] .product-action-composer footer,
.app-shell[data-product-mode='true'] .product-composer__foot,
.app-shell[data-product-mode='true'] .product-message-composer > footer {
  min-height: 56px;
  padding-top: 16px;
}

.app-shell[data-product-mode='true'] .product-answer-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.app-shell[data-product-mode='true'] .product-answer-form textarea {
  min-height: 72px;
}

.app-shell[data-product-mode='true'] .product-answer-form .btn {
  width: 108px;
}

/* Thread source reading is deliberately narrower than the Space dashboard.
   Notice, messages, empty state and composer share one vertical reading rail. */
.app-shell[data-product-mode='true'] .product-source-notice,
.app-shell[data-product-mode='true'] .product-conversation-actions,
.app-shell[data-product-mode='true'] .product-message-list {
  width: min(var(--product-reading), 100%);
  max-width: none;
  margin-right: auto;
  margin-left: auto;
}

.app-shell[data-product-mode='true'] .product-source-notice {
  min-height: 44px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 10px;
}

.app-shell[data-product-mode='true'] .product-conversation-actions {
  align-items: center;
  margin-bottom: 20px;
}

.app-shell[data-product-mode='true'] .product-message-list {
  gap: 12px;
}

.app-shell[data-product-mode='true'] .product-message-list > .empty-state {
  min-height: 132px;
  display: grid;
  place-items: center;
  padding: 24px;
  border-radius: 12px;
}

.app-shell[data-product-mode='true'] .product-message {
  padding: 18px 20px;
  border-radius: 12px;
  box-shadow: none;
}

.app-shell[data-product-mode='true'] .product-message-composer {
  gap: 12px;
  margin-top: 20px;
}

.app-shell[data-product-mode='true'] .product-message-composer textarea {
  min-height: 144px;
}

/* Open work is a readable stack. Do not squeeze questions, handoffs and
   proposals into three unrelated mini-dashboards. */
.app-shell[data-product-mode='true'] .product-open-work {
  width: min(var(--product-reading), 100%);
  max-width: none;
  gap: 12px;
  margin-right: auto;
  margin-left: auto;
}

.app-shell[data-product-mode='true'] .product-open-work > section {
  padding: 18px;
  background: var(--surface-subtle);
  border-radius: 10px;
}

.app-shell[data-product-mode='true'] .product-space-management {
  border-radius: 12px;
  box-shadow: none;
}

.app-shell[data-product-mode='true'] .product-space-management > summary {
  min-height: 56px;
  padding: 0 18px;
}

.app-shell[data-product-mode='true'] .product-space-management .product-space-grid {
  padding: 16px 18px 20px;
}

.app-shell[data-product-mode='true'] .product-space-management > summary::after {
  width: 7px;
  height: 7px;
  transform: rotate(45deg) translateY(-1px);
}

.app-shell[data-product-mode='true'] .product-space-management[open] > summary::after {
  transform: rotate(225deg) translate(-1px, -1px);
}

@media (max-width: 900px) {
  .app-shell[data-product-mode='true'] .main {
    padding: 24px 24px 56px;
  }

  .app-shell[data-product-mode='true'] .product-space-grid--primary,
  .app-shell[data-product-mode='true'] .product-space-grid--management {
    grid-template-columns: 1fr;
  }

  .app-shell[data-product-mode='true'] .product-onboarding {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

@media (max-width: 640px) {
  .app-shell[data-product-mode='true'] .main {
    padding: 18px 16px 48px;
  }

  .app-shell[data-product-mode='true'] .topbar {
    margin-bottom: 24px;
  }

  .app-shell[data-product-mode='true'] .product-space-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-shell[data-product-mode='true'] .product-space-heading .btn {
    width: 100%;
  }

  .app-shell[data-product-mode='true'] .product-space-summary,
  .app-shell[data-product-mode='true'] .product-task-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell[data-product-mode='true'] .product-space-summary > div:nth-child(2),
  .app-shell[data-product-mode='true'] .product-task-facts > div:nth-child(2) {
    border-right: 0;
  }

  .app-shell[data-product-mode='true'] .product-space-summary > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--border);
  }

  .app-shell[data-product-mode='true'] .product-onboarding,
  .app-shell[data-product-mode='true'] .product-onboarding--status {
    margin-top: 20px;
    padding: 24px 20px;
  }

  .app-shell[data-product-mode='true'] .product-space-section,
  .app-shell[data-product-mode='true'] .product-task-actions,
  .app-shell[data-product-mode='true'] .product-composer,
  .app-shell[data-product-mode='true'] .product-message-composer {
    padding: 18px;
  }

  .app-shell[data-product-mode='true'] .product-answer-form {
    grid-template-columns: 1fr;
  }

  .app-shell[data-product-mode='true'] .product-answer-form .btn {
    width: 100%;
  }
}
