/*
 * The playground. The pages are drawn by the real stylesheets (the dashboards' and the partner area's), loaded before
 * this one, so this file holds only what is new: the guided tutorial (the dimming, the spotlight, the pointing hand and
 * the guide's speech bubble) and a few small helpers for things the real pages build with inline styles.
 */

/* ------------------------------------------------------------------ layout */

/* The real dashboards lay out their body as a flex row of sidebar and main. The playground builds the same page inside
   two wrapper elements, which must not get in the way of that. */
#pg-root,
.pg-app {
  display: contents;
}

/* ------------------------------------------------------------------ small helpers */

.pg-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pg-skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 10000;
  background: #fff;
  color: #0f172a;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
}

.pg-skip:focus {
  left: 8px;
}

.pg-noscript {
  max-width: 560px;
  margin: 64px auto;
  padding: 0 16px;
  font-size: 1.0625rem;
}

.pg-noscript a {
  color: #0e7490;
  text-decoration: underline;
}

/* "Playground" label next to the account buttons, so no one mistakes this for the real thing. */
.pg-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* The "Recent Activity" panel of the dashboards: the real page gives it inline styles. */
.pg-panel {
  background: var(--surface);
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.pg-panel-title {
  font-family: "Space Grotesk", sans-serif;
  margin-bottom: 20px;
}

.pg-heading-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.pg-heading {
  font-family: "Space Grotesk", sans-serif;
  font-size: 24px;
}

.pg-count {
  color: var(--text-secondary);
  font-size: 14px;
}

.pg-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Dialog bodies */
.pg-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.pg-modal-sub,
.pg-modal-line {
  margin: 4px 0 10px;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.pg-modal-h3 {
  margin: 18px 0 8px;
  font-size: 1rem;
}

.pg-check {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pg-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.pg-list-row,
.pg-team-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  list-style: none;
}

.pg-team-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.pg-list-name {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.pg-list-name small {
  color: var(--text-secondary);
}

/* Responses to an opportunity (the real page gives these inline styles) */
.collab-request-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.pg-collab-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}

.pg-collab-name {
  font-weight: 600;
}

.pg-collab-via {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.pg-collab-message {
  font-size: 14px;
  margin-top: 8px;
  color: var(--text-secondary);
  max-width: 62ch;
}

.pg-collab-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* The preview of what the regional partner sees */
.pg-preview {
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.pg-preview h4 {
  margin: 0 0 10px;
  font-size: 0.9375rem;
}

.pg-preview-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0;
}

.pg-preview-list dt {
  font-weight: 600;
  color: var(--text-secondary);
}

.pg-preview-list dd {
  margin: 0;
}

.pg-notshared {
  display: inline-block;
  padding: 1px 10px;
  border-radius: 6px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 13px;
  font-weight: 500;
}

/* The email preview in the newsletter composer */
.pg-mail-preview {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 18px;
  font-size: 0.9375rem;
  white-space: pre-line;
}

.pg-mail-from {
  font-size: 12px;
  color: #6b7280;
  margin: 0 0 10px;
}

.pg-mail-preview h3 {
  margin: 0 0 10px;
  color: #12304e;
}

/* ------------------------------------------------------------------ the tutorial */

.pg-tour {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
}

.pg-tour[hidden] {
  display: none;
}

/* The dimmed page. In a spotlight step it is four panels around a hole, so the thing to press stays clickable and
   nothing else does; in a card step it is one panel. */
.pg-tour-dim,
.pg-tour-block {
  position: fixed;
  background: rgba(8, 15, 30, 0.74);
  pointer-events: auto;
  cursor: not-allowed;
}

.pg-tour-dim {
  inset: 0;
  display: none;
}

.pg-tour-block {
  display: none;
}

.pg-tour-ring {
  position: fixed;
  display: none;
  border: 3px solid #fbbf24;
  border-radius: 12px;
  pointer-events: none;
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.3), 0 0 28px rgba(251, 191, 36, 0.65);
  animation: pg-ring 1.4s ease-in-out infinite;
}

@keyframes pg-ring {
  0%, 100% { box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.3), 0 0 28px rgba(251, 191, 36, 0.65); }
  50% { box-shadow: 0 0 0 10px rgba(251, 191, 36, 0.12), 0 0 40px rgba(251, 191, 36, 0.9); }
}

/* The pointing hand: its fingertip rests on the middle of the thing to press, and it taps. */
.pg-tour-hand {
  position: fixed;
  width: 46px;
  height: 46px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.pg-tour-hand--on {
  opacity: 1;
  animation: pg-tap 1.1s ease-in-out infinite;
}

.pg-tour-hand-icon {
  position: relative;
  fill: #fff;
  stroke: #1e293b;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
}

.pg-tour-ripple {
  position: absolute;
  left: 6px;
  top: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.55);
  animation: pg-ripple 1.1s ease-out infinite;
}

@keyframes pg-tap {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-3px, -9px); }
}

@keyframes pg-ripple {
  0% { transform: scale(0.4); opacity: 0.9; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* The guide's speech bubble */
.pg-tour-bubble {
  position: fixed;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: min(390px, calc(100vw - 24px));
  padding: 16px 18px;
  border: 3px solid #fbbf24;
  border-radius: 20px;
  background: #fff;
  color: #1e293b;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  pointer-events: auto;
}

.pg-tour-bubble--card {
  flex-direction: column;
  align-items: center;
  width: min(480px, calc(100vw - 24px));
  padding: 26px 26px 22px;
  text-align: center;
}

.pg-tour-bubble--search {
  opacity: 0.85;
}

.pg-tour-avatar {
  flex-shrink: 0;
  width: 54px;
  height: 54px;
  padding: 5px;
  border: 3px solid #fbbf24;
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
}

.pg-tour-bubble--card .pg-tour-avatar {
  width: 72px;
  height: 72px;
}

.pg-tour-body {
  flex: 1;
  min-width: 0;
}

.pg-tour-title {
  margin: 0 0 6px;
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 1.375rem;
  font-weight: 700;
  color: #0f172a;
}

.pg-tour-text {
  margin: 0 0 12px;
  color: #1e293b;
}

.pg-tour-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.pg-tour-bubble--card .pg-tour-actions {
  justify-content: center;
}

.pg-tour-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: 2px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.pg-tour-btn--primary {
  background: #0e7490;
  color: #fff;
}

.pg-tour-btn--primary:hover {
  background: #155e75;
}

.pg-tour-btn--ghost {
  background: #fff;
  color: #0f172a;
  border-color: #cbd5e1;
}

.pg-tour-btn--ghost:hover {
  background: #f1f5f9;
}

.pg-tour-btn--link {
  padding: 6px 4px;
  background: none;
  color: #475569;
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pg-tour-btn--link:hover {
  color: #0f172a;
}

.pg-tour-count[hidden] {
  display: none;
}

.pg-tour-count {
  display: block;
  margin-top: 8px;
  font-size: 0.75rem;
  color: #64748b;
}

.pg-tour-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #e2e8f0;
  border-top-color: #0e7490;
  border-radius: 50%;
  animation: pg-spin 0.8s linear infinite;
}

@keyframes pg-spin {
  to { transform: rotate(360deg); }
}

.pg-tour-shake {
  animation: pg-shake 0.4s;
}

@keyframes pg-shake {
  0%, 100% { margin-left: 0; }
  25% { margin-left: -8px; }
  75% { margin-left: 8px; }
}

.pg-tour :focus-visible {
  outline: 3px solid #0e7490;
  outline-offset: 2px;
}

/* The bar shown while the tutorial rests or is paused: the page is free, and it says how to bring the tutorial back. */
.pg-tour-pill {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 9100;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 24px);
  padding: 10px 14px 10px 16px;
  border: 3px solid #fbbf24;
  border-radius: 999px;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
  font: 600 0.9375rem "Inter", system-ui, sans-serif;
}

.pg-tour-pill[hidden] {
  display: none;
}

.pg-tour-pill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fef3c7;
  color: #b45309;
}

.pg-tour-pill-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pg-tour-pill .pg-tour-btn {
  padding: 7px 14px;
  font-size: 0.875rem;
}

/* Paused: the button that brings the tutorial back pulses, so it is never lost. */
.pg-tour-pill--paused .pg-tour-btn--primary {
  animation: pg-continue 1.4s ease-in-out infinite;
}

@keyframes pg-continue {
  0%, 100% { box-shadow: 0 0 0 0 rgba(14, 116, 144, 0.6); }
  50% { box-shadow: 0 0 0 10px rgba(14, 116, 144, 0); }
}

/* A way back to the tutorial once it has been left */
.pg-replay {
  position: fixed;
  right: 96px;
  bottom: 28px;
  z-index: 1500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 2px solid #f59e0b;
  border-radius: 999px;
  background: #fff;
  color: #0f172a;
  font: 600 0.875rem "Inter", system-ui, sans-serif;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
  cursor: pointer;
}

.pg-replay[hidden] {
  display: none;
}

/* Keep the target clear of the sticky bars when it is scrolled into view. */
[data-pg-target] {
  scroll-margin-top: 120px;
  scroll-margin-bottom: 160px;
}

@media (max-width: 480px) {
  .pg-pill {
    padding: 2px 8px;
    font-size: 0.625rem;
  }
}

@media (max-width: 600px) {
  .pg-tour-pill {
    bottom: 12px;
    flex-wrap: wrap;
    justify-content: center;
    border-radius: 22px;
    text-align: center;
  }
}

@media (max-width: 768px) {
  .pg-tour-bubble {
    padding: 14px;
  }

  .pg-tour-avatar {
    width: 44px;
    height: 44px;
  }

  .pg-replay {
    right: 84px;
    bottom: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pg-tour-ring,
  .pg-tour-hand--on,
  .pg-tour-ripple,
  .pg-tour-spinner,
  .pg-tour-pill--paused .pg-tour-btn--primary,
  .pg-tour-shake {
    animation: none;
  }

  .pg-tour-ring {
    box-shadow: 0 0 0 6px rgba(251, 191, 36, 0.5);
  }
}

/* Project dialog: team, tasks and the little forms inside it */
.pg-inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: end;
  gap: 10px 14px;
  margin: 12px 0 4px;
}

.pg-task-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: grid;
  gap: 6px;
}

.pg-task-done {
  text-decoration: line-through;
  color: var(--text-secondary);
}

.pg-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 20px 0 40px;
}

/* Bare inputs inside the project dialog's little forms: the real page styles inputs inside .form-group only. */
.pg-inline-form > input,
.pg-inline-form .form-group input,
.pg-inline-form .form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--background);
  color: var(--text);
  font: inherit;
}

/* "Show more" under the long lists of the sample crowd. */
.pg-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 0 8px;
}

/* Project and opportunity pages, the charter and the sign-in flows. */
.pg-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--border, #e5e7eb);
  overflow: hidden;
  margin: 4px 0 12px;
}
.pg-progress span {
  display: block;
  height: 100%;
  background: var(--primary, #2563eb);
}
.pg-charter-list {
  margin: 0;
  padding-left: 1.2rem;
  line-height: 1.7;
}
.pg-modal-error {
  color: var(--danger, #b91c1c);
  font-size: 14px;
  margin: 6px 0 0;
}
.pg-modal-actions-left {
  justify-content: flex-start;
  flex-wrap: wrap;
}
.pg-task-list li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
