/* =============================================================================
   app.css — component styles shared by App-home and Concept pages.

   Loaded AFTER brand.css + layout.css. Like layout.css, this file contains NO
   hex values — every colour is a brand.css token (var(--...)). If you reach for
   a "#", add a token to brand.css instead.

   Sections:
     1. App-home  (app hero, current-concepts list, waitlist card)
     2. Shared form primitives (inputs, labels, checkbox rows)
     3. Concept page — Overview mode (option cards, current-signal panel)
     4. Concept page — View mode (embed pane, sidebar, submission preview, comments)
     5. Mode toggling + responsive
   ============================================================================= */

/* =============================================================================
   1. APP-HOME
   ============================================================================= */
.app-hero {
  padding-top: var(--space-12);
  padding-bottom: var(--space-8);
}
.app-hero .status-pill { margin-bottom: var(--space-4); }
.app-hero h1 { margin-bottom: var(--space-3); }
.app-hero .blurb {
  font-size: 1.0625rem;
  color: var(--gray-600);
  max-width: 640px;
}

.concepts {
  padding-top: var(--space-6);
  padding-bottom: var(--space-12);
}
.concepts h2 { margin-bottom: var(--space-4); }
.concept-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  background: var(--color-white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}
.concept-row .key {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: var(--color-accent-bg); color: var(--color-accent-fg);
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
}
.concept-row .meta { flex: 1; }
.concept-row h3 { margin-bottom: var(--space-1); }
.concept-row p { margin-bottom: var(--space-3); font-size: 0.9375rem; }
.concept-row .row-status {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--gray-500);
}

/* ---- Waitlist card ---- */
.waitlist {
  padding-top: var(--space-12);
  padding-bottom: var(--space-16);
}
.waitlist .card {
  background: var(--color-white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-8);
  max-width: 560px;
  margin: 0 auto;
}
.waitlist h2 { margin-bottom: var(--space-2); }
.waitlist .card > p { font-size: 0.9375rem; margin-bottom: var(--space-6); }
.waitlist .tally-embed { border: 0; display: block; width: 100%; }
.waitlist .consent { font-size: 0.8125rem; color: var(--gray-500); margin: var(--space-4) 0 0; }

/* =============================================================================
   2. SHARED FORM PRIMITIVES
   ============================================================================= */
.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field > span {
  font-size: 0.8125rem; font-weight: 500; color: var(--gray-700);
}
.field .opt { font-weight: 400; color: var(--gray-500); }
.field input[type="text"],
.field input[type="email"],
.field select,
.field textarea {
  font: inherit;
  font-size: 0.875rem;
  color: var(--color-dark);
  background: var(--color-white);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
}
.field textarea { min-height: 76px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--color-primary);
}
.field input:disabled, .field select:disabled, .field textarea:disabled {
  background: var(--gray-100); color: var(--gray-400); cursor: not-allowed;
}

.checkbox-row {
  display: flex; align-items: flex-start; gap: var(--space-2);
  font-size: 0.8125rem; color: var(--gray-700);
  background: var(--color-white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
}
.checkbox-row input { margin-top: 2px; flex: none; }
.checkbox-row .hint { display: block; margin-top: 2px; color: var(--gray-500); font-size: 0.6875rem; }
.checkbox-row.disabled { color: var(--gray-400); }

/* =============================================================================
   3. CONCEPT PAGE — OVERVIEW MODE
   ============================================================================= */
/* prominent in-page "back to Labs home" affordance (on inner App/Concept pages,
   so visitors aren't relying solely on the header logo) + hierarchy trail */
.page-nav {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding-top: var(--space-6);
}
.back-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-white);
  border: 1px solid var(--gray-300);
  border-radius: 999px;
  padding: 6px 14px;
}
.back-home:hover { border-color: var(--color-primary); text-decoration: none; }
/* secondary chip (e.g. Labs home) — lighter than the primary "back to App" chip */
.back-home.alt {
  background: transparent;
  border-color: transparent;
  color: var(--gray-600);
}
.back-home.alt:hover { color: var(--color-primary); border-color: transparent; }
.page-nav .trail { font-size: 0.8125rem; color: var(--gray-500); }
.page-nav .trail a { color: var(--gray-600); }

.concept-overview .hero { text-align: left; padding-top: var(--space-8); padding-bottom: var(--space-6); }
.concept-overview .hero h1 { max-width: 18ch; }
.concept-overview .hero .lede {
  margin: 0 0 var(--space-3); max-width: 640px;
  font-size: 1.0625rem; color: var(--gray-600); text-align: left;
}
.concept-overview .hero .meta { font-size: 0.8125rem; color: var(--gray-500); margin: 0; }
.concept-overview .hero .meta strong { color: var(--gray-700); }

.desktop-note {
  background: var(--warn-bg); color: var(--warn-fg);
  border-left: 3px solid var(--warn-border);
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  margin: 0 0 var(--space-8);
}

.options-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4);
  margin-bottom: var(--space-12);
}
.option-card {
  display: flex; flex-direction: column;
  background: var(--color-white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: var(--space-6);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.option-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}
.option-card:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.option-card .key {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  background: var(--gray-100); color: var(--gray-700);
  border-radius: 7px; font-weight: 700; font-size: 0.875rem;
  margin-bottom: var(--space-3);
}
.option-card h3 { margin: 0 0 var(--space-1); font-size: 1.1875rem; }
.option-card .paradigm { color: var(--color-primary); font-size: 0.8125rem; font-weight: 600; margin-bottom: var(--space-2); }
.option-card .desc { flex: 1; color: var(--gray-600); font-size: 0.875rem; margin: 0 0 var(--space-4); }
.option-card .stats {
  display: flex; gap: var(--space-3);
  padding-top: var(--space-3); border-top: 1px solid var(--gray-200);
  font-size: 0.8125rem; color: var(--gray-500);
}
.option-card .stats strong { color: var(--color-dark); font-size: 0.9375rem; }
.option-card .open-btn {
  margin-top: var(--space-4);
  background: var(--color-primary); color: var(--color-white);
  border: none; border-radius: var(--radius-sm);
  padding: 10px 14px; font: inherit; font-size: 0.875rem; font-weight: 600;
  transition: background .12s ease;
}
.option-card:hover .open-btn { background: var(--color-primary-hover); }

.summary {
  background: var(--color-white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: var(--space-6);
}
.summary h2 { margin: 0 0 var(--space-1); }
.summary .sub { color: var(--gray-500); font-size: 0.8125rem; margin-bottom: var(--space-6); }
.tally-bar { display: grid; gap: var(--space-3); margin-bottom: var(--space-6); }
.tally-row {
  display: grid; grid-template-columns: 130px 1fr 96px; align-items: center; gap: var(--space-3);
  font-size: 0.875rem;
}
.tally-row .label { font-weight: 600; color: var(--gray-700); }
.tally-row .bar-track { background: var(--gray-100); border-radius: 999px; height: 10px; overflow: hidden; }
.tally-row .bar-fill { background: var(--color-primary); height: 100%; border-radius: 999px; }
.tally-row .count { text-align: right; color: var(--gray-600); font-variant-numeric: tabular-nums; }
.recent-comments h3 { margin: 0 0 var(--space-3); font-size: 0.9375rem; color: var(--gray-700); }
.recent-comments .empty { color: var(--gray-500); font-size: 0.875rem; padding: var(--space-2) 0; }

/* "join the waitlist" pointer — the integrated opt-in is disabled until S3, so
   send visitors to the App-level waitlist. Overview = banner; sidebar = inline note. */
.waitlist-cta {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
  background: var(--color-accent-bg);
  color: var(--color-accent-fg);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-6);
  margin-bottom: var(--space-12);
  font-size: 0.9375rem; font-weight: 500;
}
.waitlist-cta a { color: var(--color-accent-fg); font-weight: 700; }
.sidebar-note { font-size: 0.8125rem; color: var(--gray-600); }
.sidebar-note a { font-weight: 600; }

/* =============================================================================
   4. CONCEPT PAGE — VIEW MODE
   ============================================================================= */
.view-wrap { max-width: 1440px; margin: 0 auto; padding: var(--space-4) var(--space-6) var(--space-12); }
.concept-view {
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 0;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-white);
  min-height: 700px;
}

.embed-pane {
  display: flex; flex-direction: column;
  padding: var(--space-4);
  background: var(--gray-100);
  min-width: 0;
}
.embed-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--space-3); gap: var(--space-3); flex-wrap: wrap;
}
.embed-toolbar .back-btn {
  background: var(--color-white); border: 1px solid var(--gray-300); color: var(--gray-700);
  padding: 6px 12px; border-radius: var(--radius-sm); font: inherit; font-size: 0.8125rem; font-weight: 500;
}
.embed-toolbar .back-btn:hover { color: var(--color-dark); border-color: var(--gray-500); }
.embed-toolbar .other-options { display: flex; gap: var(--space-1); align-items: center; }
.embed-toolbar .toolbar-right { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.embed-toolbar .other-options span { font-size: 0.75rem; color: var(--gray-500); margin-right: var(--space-1); }
.embed-toolbar .open-tab {
  font-size: 0.75rem; font-weight: 600; color: var(--color-primary);
  background: var(--color-white); border: 1px solid var(--gray-300);
  padding: 5px 11px; border-radius: var(--radius-sm);
}
.embed-toolbar .open-tab:hover { border-color: var(--color-primary); text-decoration: none; }
.embed-toolbar .other-options button {
  background: var(--color-white); border: 1px solid var(--gray-300); color: var(--gray-600);
  padding: 5px 11px; border-radius: var(--radius-sm); font: inherit; font-size: 0.75rem; font-weight: 600;
}
.embed-toolbar .other-options button:hover { color: var(--color-primary); border-color: var(--color-primary); }
.embed-toolbar .other-options button.active {
  background: var(--color-primary); color: var(--color-white); border-color: var(--color-primary);
}
.embed-frame {
  flex: 1;
  border: 1px solid var(--gray-300); border-radius: var(--radius);
  background: var(--color-white); box-shadow: var(--shadow-md);
  overflow: hidden; min-height: 600px;
}
.embed-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.embed-caption { color: var(--gray-500); font-size: 0.75rem; margin-top: var(--space-2); padding-left: var(--space-1); }

.sidebar {
  display: flex; flex-direction: column; gap: var(--space-4);
  padding: var(--space-6);
  border-left: 1px solid var(--gray-200);
  overflow-y: auto;
}
.sidebar .which { font-size: 0.75rem; color: var(--gray-500); }
.sidebar h2 { margin: 0; font-size: 1.25rem; }
.sidebar .paradigm-line { color: var(--color-primary); font-weight: 600; font-size: 0.875rem; }
.sidebar .desc { color: var(--gray-600); font-size: 0.8125rem; margin: var(--space-1) 0 0; }

/* ---- action area (S2 preview — disabled) ---- */
.action-area {
  padding: var(--space-4) 0;
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
  display: flex; flex-direction: column; gap: var(--space-3);
}
.s3-pill {
  align-self: flex-start;
  background: var(--warn-bg); color: var(--warn-fg);
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
}
.action-buttons { display: flex; flex-direction: column; gap: var(--space-2); }
.btn-vote {
  width: 100%; background: var(--color-primary); color: var(--color-white);
  border: none; border-radius: var(--radius-sm); padding: 12px;
  font: inherit; font-size: 0.875rem; font-weight: 600;
}
.btn-comment-only {
  width: 100%; background: var(--color-white); color: var(--color-primary);
  border: 1.5px solid var(--color-primary); border-radius: var(--radius-sm); padding: 10px;
  font: inherit; font-size: 0.8125rem; font-weight: 600;
}
.btn-vote:disabled, .btn-comment-only:disabled {
  opacity: 0.55; cursor: not-allowed;
}

/* ---- submission form preview (all controls disabled in S2) ---- */
.submit-form {
  display: flex; flex-direction: column; gap: var(--space-3);
  border: 1px solid var(--gray-200); border-radius: var(--radius);
  background: var(--color-light); padding: var(--space-4);
}
.submit-form .form-header { font-weight: 600; font-size: 0.875rem; color: var(--color-dark); }
.submit-form .form-sub { font-size: 0.75rem; color: var(--gray-500); margin-top: calc(-1 * var(--space-2)); }
.submit-form .form-actions { display: flex; gap: var(--space-2); justify-content: flex-end; }
.submit-form .form-actions .submit {
  background: var(--color-primary); color: var(--color-white); border: none;
  padding: 9px 16px; border-radius: var(--radius-sm); font: inherit; font-size: 0.8125rem; font-weight: 600;
}
.submit-form .form-actions .submit:disabled { opacity: 0.55; cursor: not-allowed; }

.current-count { font-size: 0.8125rem; color: var(--gray-500); }
.current-count strong { color: var(--color-dark); }

.comments-section h3 { margin: 0 0 var(--space-3); font-size: 0.9375rem; }
.comment-empty { color: var(--gray-500); font-size: 0.8125rem; padding: var(--space-2) 0; }

/* =============================================================================
   5. MODE TOGGLING + RESPONSIVE
   ============================================================================= */
.concept-overview, .concept-view { display: none; }
body[data-mode="overview"] .concept-overview { display: block; }
body[data-mode="A"] .concept-view,
body[data-mode="B"] .concept-view,
body[data-mode="C"] .concept-view,
body[data-mode="view"] .concept-view { display: grid; }

/* the view-mode wrapper only shows when a view is active.
   data-mode="view" = single-design Concept pages (no overview mode) that show
   the embed + sidebar layout permanently (e.g. /requirements-manager/walkthrough/). */
.view-wrap { display: none; }
body[data-mode="A"] .view-wrap,
body[data-mode="B"] .view-wrap,
body[data-mode="C"] .view-wrap,
body[data-mode="view"] .view-wrap { display: block; }

@media (max-width: 880px) {
  .options-grid { grid-template-columns: 1fr; }
}
/* the embed-pane desktop note is redundant on wide screens (the overview
   already carries one) — show it only when the embed is cramped on mobile */
.embed-pane .desktop-note { display: none; }

@media (max-width: 900px) {
  .concept-view { grid-template-columns: 1fr; min-height: 0; }
  .sidebar { border-left: none; border-top: 1px solid var(--gray-200); }
  /* the embedded prototypes are desktop-width; let the frame scroll both axes
     so the whole concept is reachable instead of being clipped, and surface
     the "Open full size" link prominently (see .desktop-note above). */
  .embed-frame {
    min-height: 0; height: 72vh;
    overflow: auto; -webkit-overflow-scrolling: touch;
  }
  .embed-frame iframe { width: 1200px; height: 760px; }
  .embed-pane .desktop-note { display: block; margin: 0 0 var(--space-3); }
}
@media (max-width: 600px) {
  .concept-row { flex-direction: column; }
}

/* =============================================================================
   6. S3 — LIVE FORM, VOTE STATE, COMMENT THREAD, ADMIN
   ============================================================================= */

/* ---- Submission form (live — replaces the disabled S2 preview) ---- */
/* .submit-form's display:flex overrides the HTML hidden attribute (author CSS
   beats the UA [hidden]{display:none} rule), so restate it explicitly — the
   form state machine toggles visibility via the hidden attribute. */
.submit-form[hidden] { display: none; }
.submit-form h4 { margin: 0; font-size: 0.9375rem; }
.consent-note { font-size: 0.6875rem; color: var(--gray-500); margin: 0; }
.btn-submit {
  flex: 1;
  background: var(--color-primary); color: var(--color-white);
  border: none; border-radius: var(--radius-sm); padding: 10px 16px;
  font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer;
}
.btn-submit:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-cancel {
  background: var(--color-white); color: var(--gray-600);
  border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm); padding: 10px 14px;
  font: inherit; font-size: 0.875rem; cursor: pointer;
}
.btn-cancel:hover { border-color: var(--gray-500); }
.form-error { font-size: 0.8125rem; color: var(--color-error); margin: 0; }

/* ---- Sentiment vote (single-design Concepts — three equal-weight choices
        so the button styling doesn't bias the vote) ---- */
.btn-sentiment {
  width: 100%; background: var(--color-white); color: var(--color-dark);
  border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm); padding: 11px 12px;
  font: inherit; font-size: 0.875rem; font-weight: 600; text-align: left; cursor: pointer;
}
.btn-sentiment:hover { border-color: var(--color-primary); color: var(--color-primary); }
/* longer sentiment labels need a wider tally label column */
.summary.sentiment .tally-row { grid-template-columns: 200px 1fr 96px; }

/* ---- Vote states ---- */
.voted-badge { font-size: 0.9375rem; color: var(--color-accent-fg); font-weight: 500; margin: 0 0 var(--space-2); }
.thankyou-msg { font-size: 0.9375rem; font-weight: 600; color: var(--color-accent-fg); margin: 0 0 var(--space-2); }

/* ---- Comment thread (sidebar + overview) ---- */
.comment-row {
  background: var(--color-white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
}
.comment-row.reply {
  margin-left: var(--space-4);
  background: var(--color-accent-bg);
  border-color: var(--color-accent);
}
.comment-meta { display: flex; gap: var(--space-2); margin-bottom: var(--space-1); flex-wrap: wrap; }
.comment-persona {
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--gray-500);
  background: var(--gray-100); border-radius: 999px; padding: 2px 8px;
}
.comment-variant {
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--color-white);
  background: var(--color-primary); border-radius: 999px; padding: 2px 8px;
}
.comment-admin-badge {
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--color-accent-fg);
  background: var(--color-accent-bg); border-radius: 999px; padding: 2px 8px;
}
.comment-text { margin: 0; font-size: 0.875rem; color: var(--color-dark); }

/* ---- Admin page ---- */
.admin-comment {
  background: var(--color-white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}
.admin-comment-meta { font-size: 0.75rem; color: var(--gray-500); margin-bottom: var(--space-2); }
.admin-reply {
  background: var(--color-accent-bg);
  border-left: 3px solid var(--color-accent);
  padding: var(--space-2) var(--space-3);
  margin: var(--space-2) 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.8125rem;
}
.admin-comment-actions { display: flex; gap: var(--space-2); margin-top: var(--space-3); flex-wrap: wrap; }
.admin-comment-actions button {
  background: var(--color-white); border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm); padding: 6px 12px;
  font: inherit; font-size: 0.8125rem; cursor: pointer;
}
.admin-comment-actions button:hover { border-color: var(--color-primary); color: var(--color-primary); }
.admin-reply-form {
  margin-top: var(--space-3);
  display: flex; flex-direction: column; gap: var(--space-2);
}
.admin-reply-form textarea {
  font: inherit; font-size: 0.875rem;
  border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm);
  padding: 9px 11px; resize: vertical;
}
.admin-reply-form textarea:focus { outline: none; border-color: var(--color-primary); }
.admin-reply-form button {
  align-self: flex-start;
  background: var(--color-primary); color: var(--color-white);
  border: none; border-radius: var(--radius-sm); padding: 8px 14px;
  font: inherit; font-size: 0.8125rem; cursor: pointer;
}
.admin-reply-form button:disabled { opacity: 0.55; cursor: not-allowed; }
.admin-reply-form button + button {
  background: var(--color-white); color: var(--gray-600);
  border: 1px solid var(--gray-300);
}
.admin-reply-form button + button:hover { border-color: var(--gray-500); }
